This is a sample setup for APIGateway with VPCLink (NLB) to ALB into EC2. NLB, ALB and EC2 are all in private subnet.
-
npm run build
-
cdk deploy and wait for the Cloudformation Stack deployment to complete
-
Please update the ALB IPs in the
nlb-alb-stack.tsunderlibconst ALB_IP1= "" const ALB_IP2= "" -
You can get the ALB IPs by using the AWS Systems Manager Run Command
-
Update the ALB IPs and redeploy.
This could also be automated using Systems Manager Automation (work in progress) or alternatively, you can use the Lambda function from this blog article to have the NLB auto-register ALB IPs (when it changes) https://aws.amazon.com/blogs/networking-and-content-delivery/using-static-ip-addresses-for-application-load-balancers/
npm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation template

