Let’s dive into AWS CDK with an example

Overview:

Use the AWS CDK to define your cloud resources in a familiar programming language. The AWS CDK supports TypeScript, JavaScript, Python, Java, and C#/.Net.

Why use the AWS CDK?

Prerequisites: [knowledge about the following]
• AWS CloudFormation
• Java
• git
• node.js

Into example Application:

npm install -g aws-cdk # install latest version npm install -g aws-cdk@X.YY.Z # install specific version
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

cdk ls

D:\cdk\aws-cdk-examples-master\java\api-cors-lambda-crud-dynamodb>cdk deploy

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

cdk destroy

Issues:

The first time you deploy an AWS CDK app into an environment (account/region), you’ll need to install a “bootstrap stack”.

cdk bootstrap

References:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store