krimple / sample-cdk-queue-and-sqs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

About


Languages

Language:TypeScript 55.6%Language:JavaScript 44.4%