image

AWS CDK

Built with:

Infrastructure as Code

In a customer project, I was asked to migrate a serverless solution to AWS CDK. In this context, the deployment process has been migrated to the new CDK Pipelines for Continuous Integration and Continuous Deployment (CI/CD).

Each time a commit the apps source code in AWS CodeCommit is made, CDK creates, tests, and distributes the new version of the serverless app to any previously defined AWS account.

Since the CI/CD pipeline itself is also part of the AWS CDK stack, the pipeline adapts in a self-mutating process.


The Challenge

Standardizing
The production system shared its environment with other projects. Team members also had access to the production environment via the console. A clear separation into individual accounts for each project environment as well as standardized access policies for team members were required.

Migrating
The previously created resources and their data had to be moved to the separate production environment and restored.


The Advantages for my Client

Cross-Account Deployments
The app’s CloudFormation stack can now be deployed from a separate non-production account. Team members no longer need access to the Prod environment to perform deployments. This minimized the risk of stack drift or accidental deletion of resources.

Fully automated CI/CD process
By migrating the deployment process from CloudFormation to CDK pipelines, the project can benefit from all the advantages of a CI / CD Pipeline. Changes to the system can easily be deployed in any test environment without manual steps involved in building, testing, and deploying.


The Solution

CDK Pipelines is a self-updating CI/CD process for infrastructure as code systems. This means that any changes to the application stack or the CDK Pipeline itself will automatically update the application stack or reconfigure the deployment pipeline.

The following image shows a pipeline created as a CDK Pipeline:

CDK Pipeline with CodePipeline

To see how this process works in all its detail there is a good article at the AWS Developer Blog.


Side Note

To me as a German this sounds a bit like Baron Munchausen, a fictional German nobleman created by the German writer Rudolf Erich Raspe who saves himself from being drowned in a swamp by pulling on his own hair.

  • Author

    Andreas
  • Categories

    DevOps, CI/CD, AWS CDK, CloudFormation, Serverless