Welcome to your CDK TypeScript project!
This one is from re:invent session on Building production prototypes
The sample builds a Lambda and API Gateway that accepts a JSON payload for a review, validates, then sends to an SQS Queue in a Lambda.
To build and run:
npm run build
first time...
cdk bootstrap
subsequent changes
cdk deploy
removing
cdk destroy
testing
Use https://reqbin.com/req/c-dwjszac0/curl-post-json-example or PostMan or whatever... Here is the CURL example:
curl -X POST https://l38cw4xtm3.execute-api.us-east-1.amazonaws.com/prod/
-H 'Content-Type: application/json'
-d '{"productId":"2wwedfsdf","title":"Silly Love Songs", "text": "This is my silly love songs song", "rating": 2.5}'
The cdk.json
file tells the CDK Toolkit how to execute your app.
Useful commands
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm 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