The CDK template deploys a Lambda function, an SQS queue and the IAM permissions required to run the application. SQS invokes the Lambda function when new messages are available.
Run cdk deploy
. This will deploy / redeploy your Stack to your AWS Account.
After the deployment you will see the queue's URL.
- Send the SQS message:
aws sqs send-message --queue-url ENTER_YOUR_SQS_QUEUE_URL --message-body "Test message"
- Retrieve the logs from the Lambda function:
aws logs describe-log-streams --log-group-name '/aws/lambda/<LAMBDA_FUNCTION_NAME>' | jq '.logStreams[0].logStreamName'
aws logs get-log-events --log-group-name '/aws/lambda/<LAMBDA_FUNCTION_NAME>' --log-stream-name 'LOGSTREAM_NAME_FROM_ABOVE_OUTPUT'
To see the Cloudformation template generated by the CDK, run cdk synth
, then check the output file in the "cdk.out" directory.