This is a stable example. It should successfully build out of the box
This examples does is built on Construct Libraries marked "Stable" and does not have any infrastructure prerequisites to build.
The ALB is backed by an EC2 instance acting as frontend client and built-in ALB response rules that simulates mobile and application api
curl -H "Host: mobile.mydomain.com" [ALB-DNS-FQDN]/productionResonse received
{"status":"succes","apiversion":"prod_mobile_v1"}curl -H "Host: api.mydomain.com" [ALB-DNS-FQDN]/production{"status":"succes","apiversion":"prod_api_v1"}It is a Maven-based project, so you can open this directory with any Maven-compatible Java IDE, and you should be able to build and run tests from your IDE.
You should explore the contents of this template. It demonstrates a CDK app to create a multi-rule ALB, based on path and host headers.
More information on ALB and Path routing is available here https://docs.aws.amazon.com/elasticloadbalancing/latest/application/tutorial-load-balancer-routing.html
The cdk.json file tells the CDK Toolkit how to execute your app. This example relies on maven to do that.
mvn packagecompile and run testscdk lslist all stacks in the appcdk synthemits the synthesized CloudFormation templatecdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk docsopen CDK documentation
Enjoy!
