Let’s dive into AWS CDK with an example
The AWS Cloud Development Kit (AWS CDK) is a software development framework for defining your cloud infrastructure in code and provisioning it through AWS CloudFormation.
Why use the AWS CDK?
· A small CDK class produces an AWS CloudFormation template of more than hundreds of lines;
· Use logic (if statements, for-loops, etc) when defining your infrastructure
· Use object-oriented techniques to create a model of your system
· Define high-level abstractions, share them, and publish them to your team, company, or community
· Organize your project into logical modules
· Share and reuse your infrastructure as a library
· Testing your infrastructure code using industry-standard protocols
· Use your existing code review workflow
· Code completion within your IDE
Prerequisites: [knowledge about the following]
• AWS CloudFormation
Into example Application:
npm install -g aws-cdk # install latest version
npm install -g aws-cdk@X.YY.Z # install specific version
Configure credentials locally https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
Checkout code from git location https://github.com/awsdocs/aws-doc-sdk-examples
go into folder …\aws-cdk-examples\java\api-cors-lambda-crud-dynamodb
Once successfully deployed, it will show you the URL for REST API calls.
You can validate the deployments by login into aws account.
Violla, the application is successfully deployed and accessed using postman.
Now we need to remove the deployment for that
The first time you deploy an AWS CDK app into an environment (account/region), you’ll need to install a “bootstrap stack”.