Skip to content

Commit

Permalink
fix(infra): 1/3 NLB pointing to ALB
Browse files Browse the repository at this point in the history
Ref. metriport/metriport-internal#1040

Signed-off-by: Rafael Leite <[email protected]>
  • Loading branch information
leite08 committed Jun 19, 2024
1 parent 1a97fc9 commit aceb133
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/infra/lib/api-stack/api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
NetworkTargetGroup,
Protocol,
} from "aws-cdk-lib/aws-elasticloadbalancingv2";
import { AlbTarget } from "aws-cdk-lib/aws-elasticloadbalancingv2-targets";
import * as iam from "aws-cdk-lib/aws-iam";
import { IFunction as ILambda } from "aws-cdk-lib/aws-lambda";
import * as rds from "aws-cdk-lib/aws-rds";
Expand Down Expand Up @@ -360,6 +361,7 @@ export function createAPIService({
),
});

const alb = fargateServiceAlb.loadBalancer;
const nlb = new NetworkLoadBalancer(stack, `ApiNetworkLoadBalancer`, {
vpc,
internetFacing: false,
Expand All @@ -372,8 +374,8 @@ export function createAPIService({
port: listenerPort,
protocol: Protocol.TCP,
vpc,
targets: [new AlbTarget(alb, listenerPort)],
});
nlbTargetGroup.addTarget(fargateServiceAlb.service);
nlbListener.addTargetGroups("ApiNetworkLoadBalancerTargetGroup", nlbTargetGroup);

// Health checks
Expand Down

0 comments on commit aceb133

Please sign in to comment.