A Simple CDK CRUD application with AWS Lambda , API Gateway V2 and DynamoDB
The cdk.json
file tells the CDK Toolkit how to execute your app.
Getting Started Clone the repository.
git clone https://github.com/KaranGauswami/aws-cdk-serverless-starter.git
Install the dependencies:
yarn install --frozen-lockfile
Deploy the Stack:
yarn cdk deploy
The output should resemble the following:
Outputs:
SampleAppStack.ApiEndpointUrl = https://h5iqvrqog7.execute-api.ap-south-1.amazonaws.com
Create an Item Using API:
curl --location '{ApiEndpointUrl}/items' --header 'Content-Type: application/json' --data '{"Name": "First Item"}'
Get All Items Using API:
curl --location '{ApiEndpointUrl}/items'
Make sure to replace {ApiEndpointUrl} with the actual API endpoint URL provided during the stack deployment.
yarn cdk destroy
yarn run build
compile typescript to jsyarn run watch
watch for changes and compileyarn run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template