
In this module we will test the serverless application by sending a message to the newly created SQS queue so we can observe it triggering the Lambda function and publishing the result into the S3 bucket.
Use the following command to get the SQS URL and store it in $SQS_URL environment variable
SQS_URL=$(aws sqs list-queues --output json | jq -r '.QueueUrls|map(select(contains("test-sqs-lambda-s3"))) | .[0]' | tr -d '[:space:]')
The command will only store the first url that contains test-sqs-lambda-s3 in the name. Validate you have the correct url:
echo $SQS_URL
Send a message to the queue.
aws sqs send-message --queue-url $SQS_URL --message-body abc
Or send 100 messages to the queue.
for i in {1..100}; do aws sqs send-message --queue-url $SQS_URL --message-body abc ; done
Navigate to the AWS console and observe the SQS triggering the Lambda, and publishing the result in the S3 bucket.
In this module, we tested the serverless application by sending messages to the SQS queue to verify that it triggers the Lambda function and publishes the result to the S3 bucket.