This is a blank project for CDK development with TypeScript.
The cdk.json
file tells the CDK Toolkit how to execute your app.
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
- Provision your AWS account via https://dashboard.eventengine.run/dashboard by entering the event hash provided by AWS
- Select Email OTP option and enter your email used for registration
- Follow login steps and open the AWS console
- Launch an AWS Cloud9 m5.large environment in ca-central-1 with default settings
- Open the IDE environment and clone the provided git repo
git clone https://github.com/ejahnke/workshopVpc.git
- update/workshopVpc/bin/my_vpcmoh_application.ts with your current AWS account number and region
- navigate into the recently cloned folder workshopVpc and install required libraries
cd workshopVpc
npm install aws-cdk-lib
- bootstrap the AWS account for CDK deployments
cdk bootstrap
- deploy the CDK stack which will create an AWS CodeCommit repository and an AWS CodePipeline for our subsequent deployments
cdk deploy
- Once deployment is complete, navigate to the IAM service in the AWS console and find a role with the following embedded string in its name VPCPipelineBuildSynthCdk
- Edit such role and add the following permission to the existing customer inline policy: Service = ec2, Action = DescribeAvailabilityZones
- Review the newly created assets under CodeCommit and CodePipeline. Gather the HTTPS (GRC) URL from the CodeCommit repository (e.g. codecommit::ca-central-1://WorkshopVPCRepo)
- Go back into the AWS Cloud9 environment and uncomment the code under //after initial deployment in /workshopVpc/lib/my_vpcmoh_application-stack.ts. This new code will deploy AWS Fargate clusters based on a custom docker image file along with an Application Load Balancer. It will deploy these assets on a new VPC which has its own NAT Gateway, Internet Gateway and required subnets.
- Reset the git configuration inside workshopVpc
rm -rf .git
git init
git add --all
git commit -m "initial commit"
git remote add myrepo <HTTPS_GRC_URL_FROM_CODECOMMIT>
git push -u myrepo master
- The above commit will trigger the AWS CodePipeline and deploy the assets. (approx. 10 minutes)
- Once deployed, navigate into the EC2 service in the AWS console and open Load Balancers. You will see two new Application Load Balancers with public DNS entries for testing. One hosts a customized Apache HTTP server and the other a standard Payara server instance.