aws
Markdown

awsMultiEnvCICD

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:

  1. 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

  2. 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

  3. Bootstrap the target environments (dev, staging, production, disaster recovery).

  4. Set up a new GitHub repository for the project.

  5. Create a personal access token in GitHub and store it in AWS Secrets Manager. This is to be done in the tooling account

  6. 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

  7. 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

  8. Create a simple CDK application with API Gateway and Lambda function.

  9. Add the application to the pipeline and define the dev environment as deployment target.

  10. Manually deploy the pipeline once using cdk deploy.

  11. Push changes to GitHub to trigger the pipeline.

  12. Add a staging environment to the pipeline.

  13. Push changes to GitHub to update the pipeline.

  14. Add production and disaster recovery environments to the pipeline using addWave for parallel deployment.

  15. Push final changes to GitHub to complete the multi-environment pipeline setup.

  16. Verify deployments in each target environment.