Member-only story
Best Practices to develop CDK Constructs | AWS CDK
In this post, we will discuss the best practices to develop CDK constructs which are the building blocks of your AWS CDK applications.
Best Practices
AWS CDK provides the platform to develop the cloud infrastructure code with the help of a programming language like Javascript, Python, etc.
Constructs are the key components in AWS CDK which help in defining the AWS resources. For instance, if we talk about AWS S3, there would be a CDK construct representing this resource type. Or you can have a construct representing an EC2 Auto Scaling Group. Such constructs are available in all the supported languages.
In this post, we will understand following best practices to develop CDK constructs —
- Model with Constructs, Deploy with Stacks
- Configure with properties, not environment variables
- Unit test your infrastructure
- Do not change the logical ID
- Do not rely on constructs for compliance