# Amazon SQS Queue to AWS Lambda This pattern creates an Amazon SQS Queue, AWS Lambda function and setup event sourcing from the Queue to the Lambda function. ## Getting started with Terraform Serverless Patterns Read more about general requirements and deployment instructions for Terraform Serverless Patterns [here](https://github.com/aws-samples/serverless-patterns/blob/main/terraform-fixtures/docs/README.md). ## Testing After deployment, send a message to the SQS queue. Go to the CloudWatch Logs for the deployed Lambda function. You will see the event is logged out containing the item data. To do this, you can run these commands in the terminal (replace `` with the value returned in `sqs_queue_id`): ```shell aws sqs send-message --queue-url --message-body "Test message" # Sample output { "MD5OfMessageBody": "82dfa5549ebc9afc168eb7931ebece5f", "MessageId": "362f04c9-ac60-4f7b-be33-05e2dc0af2c2" } ``` ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| | [random](#provider\_random) | >= 2.0 | ## Modules | Name | Source | Version | |------|--------|---------| | [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 4.0 | | [sqs](#module\_sqs) | terraform-aws-modules/sqs/aws | ~> 3.0 | ## Resources | Name | Type | |------|------| | [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | ## Inputs No inputs. ## Outputs | Name | Description | |------|-------------| | [lambda\_function\_arn](#output\_lambda\_function\_arn) | The ARN of the Lambda Function | | [lambda\_function\_invoke\_arn](#output\_lambda\_function\_invoke\_arn) | The Invoke ARN of the Lambda Function | | [lambda\_function\_name](#output\_lambda\_function\_name) | The name of the Lambda Function | | [lambda\_function\_qualified\_arn](#output\_lambda\_function\_qualified\_arn) | The ARN identifying your Lambda Function Version | | [lambda\_function\_version](#output\_lambda\_function\_version) | Latest published version of Lambda Function | | [lambda\_role\_arn](#output\_lambda\_role\_arn) | The ARN of the IAM role created for the Lambda Function | | [sqs\_queue\_arn](#output\_sqs\_queue\_arn) | The ARN of the SQS queue | | [sqs\_queue\_id](#output\_sqs\_queue\_id) | The URL for the created Amazon SQS queue |