AWS Cloud Development Kit Hands On (CDK)
2 min readMay 20, 2021
Run Step by step below statements on AWS console like as Figure 2# 1. install the CDKsudo npm install -g aws-cdk# directory name must be cdk-app/ to go with the rest of the tutorial, changing it will cause an errormkdir cdk-appcd cdk-app/# initialize the applicationcdk init --language javascript# verify it works correctlycdk ls# install the necessary packagesnpm install @aws-cdk/aws-s3 @aws-cdk/aws-iam @aws-cdk/aws-lambda @aws-cdk/aws-lambda-event-sources @aws-cdk/aws-dynamodb# 2. copy the content of cdk-app-stack.js into lib/cdk-app-stack.js# 3. setup the Lambda functionmkdir lambda && touch index.py# 4. bootstrap the CDK applicationcdk bootstrap# 5. (optional) synthesize as a CloudFormation templatecdk synth# 6. deploy the CDK stackcdk deploy# 7. empty the s3 bucket# 8. destroy the stackcdk destroy
Figure 2
When deploy successful we will go to s3 bucket console upload sample image
and see result will be saved on DynamoDB like picture below