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.ts
underlib
const 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 build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template