DEV Community

Cover image for WORKING WITH AWS CLOUD DEVELOPMENT KIT (CDK)
Kadiri George
Kadiri George

Posted on

WORKING WITH AWS CLOUD DEVELOPMENT KIT (CDK)

AWS CDK is an open-source software development framework used to model and provision your cloud applications resources with familiar programming languages such as Python, Java, .NET, Go and Typescript.
Working with AWS CDK helps to deploy infrastructure as code with one favorite programming language instead of using CloudFormation which uses either JSON or YAML format.
When using Typescript for the CDK one needs to install Node.js on the PC.
CDK Building Block
cdk init - cdk init app – Language typescript. It will initialize the script with the prefer programming language in this case it is typescript.
cdk bootstrap – It is use only once for any deployment with CDK to the account of deployment.
cdk deploy – Deploy this stack to your default AWS account.
cdk destroy – Destroy this stack in your default AWS account.
cdk diff – Compare deployed stack with current stack.
cdk synth - Synthesizes and prints the CloudFormation template for one or more specified stacks.
With just a line of code a line of code I was to deploy an S3 bucket into my account.
const bucket = new s3.Bucket(this, 'MyFirstBucket'{bucketName:’myserverless-kadiri’});
CDK improve infrastructure and business logic. It automates AWS services provision with construct.
I was able to use AWS CDK to deploy an EC2 instance which runs python application, connect to my GITHUB repository and able to use it deploy with CodePipeline, CodeBuild and CodeDeploy. With all the resources I created, I was not bothered about the cost on AWS because with cdk destroy I can delete all the resources created. It can also be helpful to create a stagging services which can be deleted every night and started again every morning to save cost.
Useful link to get started with AWS CDK
https://lnkd.in/gTDaGcBi
https://lnkd.in/gCU23YgC
Thanks for reading.

Top comments (0)