Organize and Deploy NLB Stack

Organize and Deploy NLB Stack

  1. Open the root file Fcj2024CdkApp.

    Architecture

  2. Create an NLB Stack with the ID Nlb using the following code:

NlbStack nlbStack = new NlbStack(app, "Nlb", StackProps.builder()
       .build());

Architect

  1. Pass the previously created VPC to the ClusterStackProps of the ECS stack:
new ClusterStackProps(vpcStack.getVpc())

Architect

  1. Add environmen and Tags for NLB Stack
   .env(environment)
   .tags(infraTags)

Architect

  1. Because the Network Load Balancer (NLB) requires a VPC to be created, let’s add a dependency to ensure that the VPC is created before the NLB:
   nlbStack.addDependency(vpcStack);

Architect

Deploy NLB using AWS CDK

  1. Deploy the Network Load Balancer (NLB) using AWS CDK:
   cdk deploy --all --require-approval never

Architect

Check AWS Resources Created

  1. In the AWS Management Console, navigate to EC2.

    Architecture

  2. In the EC2 interface, select Load Balancers to view the created Network Load Balancer (NLB) and Application Load Balancer (ALB).

    Architecture

  3. In the EC2 interface, enter “API Gateway” into the search bar and select API Gateway from the results.

    Architecture

  4. In the API Gateway interface, select VPC links to view the successfully created VPC link.

Architecture