Skip to content

Files

Latest commit

 

History

History

sqs-lambda

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Amazon SQS to AWS Lambda

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.

Deploy

Run cdk deploy. This will deploy / redeploy your Stack to your AWS Account.

After the deployment you will see the queue's URL.

Testing

  1. Send the SQS message:
aws sqs send-message --queue-url ENTER_YOUR_SQS_QUEUE_URL --message-body "Test message"
  1. 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'

Synthesize Cloudformation Template

To see the Cloudformation template generated by the CDK, run cdk synth, then check the output file in the "cdk.out" directory.