cdk bootstrap
Used to bootstrap AWS environments for CDK deployment
cdk init
Used to initialize a new CDK project
git init
Used to initialize a Git repository
git remote add origin [URL]
Used to add a remote GitHub repository
git add .
Used to stage all files for commit
git commit -m "[message]"
Used to commit changes
git push -u origin main
Used to push commits to the GitHub repository
cdk deploy
Used to deploy the CDK stack (only needed once for initial pipeline setup)
pipeline.addStage()
Used in code to add deployment stages to the pipeline
pipeline.addWave()
Used in code to add parallel deployment stages to the pipeline
Here are the main steps of the process described in the presentation:
Set up AWS CLI profiles for target accounts. aws configure sso The start url is at the https://d-9667667782.awsapps.com/start/#/?tab=accounts under access key the sso registration scope is the default then choose the profile
Bootstrap the tooling account using CDK bootstrap command. npx cdk bootstrap --profile
--cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://ACCOUNT_ID/tooling-account-region Bootstrap the target environments (dev, staging, production, disaster recovery).
Set up a new GitHub repository for the project.
Create a personal access token in GitHub and store it in AWS Secrets Manager. This is to be done in the tooling account
Initialize a new CDK project using cdk init. make directory cd into the directory cdk init --language typescript git status git branch -m main git remote add origin https://github.com/robertrahardja/rrtcdk.git git remote -v git add and commit
Define the pipeline in code (demo-pipeline-stack.ts file). use the aws-cdk-lib.pipeline Set env in the bin file for account and region add and commit to repository cdk deploy --profile
Then it will be automatic Create a simple CDK application with API Gateway and Lambda function.
Add the application to the pipeline and define the dev environment as deployment target.
Manually deploy the pipeline once using cdk deploy.
Push changes to GitHub to trigger the pipeline.
Add a staging environment to the pipeline.
Push changes to GitHub to update the pipeline.
Add production and disaster recovery environments to the pipeline using addWave for parallel deployment.
Push final changes to GitHub to complete the multi-environment pipeline setup.
Verify deployments in each target environment.