SQS Queue Standard
π¦ Overviewβ
This Terraform module provisions a standard Amazon SQS queue, enabling high-throughput, decoupled messaging between distributed services.
Itβs ideal for buffering asynchronous tasks, managing retries, or coordinating microservices in a scalable architecture.
β Key Featuresβ
- Creates a named standard SQS queue in the specified region
- Supports configuration for delay, message retention, and visibility timeout
- Optionally enables KMS encryption for secure message storage
- Designed for high-throughput workloads with at-least-once delivery
πΌ Use Casesβ
- Decoupling components in microservice architectures
- Buffering background jobs and async workloads
- Managing event retries and fault-tolerant messaging
- Triggering AWS Lambda or ECS tasks via message-driven patterns
π₯ Input Variablesβ
| Name | Type | Description |
|---|---|---|
region | string | AWS region to deploy the queue |
queue_name | string | Name of the SQS queue |
delay_seconds | number | (Optional) Delay before message delivery (in seconds) |
message_retention | number | (Optional) How long to retain messages (in seconds) |
visibility_timeout | number | (Optional) Visibility timeout for message processing (in seconds) |
kms_key_arn | string | (Optional) ARN of the KMS key for encrypting queue messages |
environment | string | Tag to specify the deployment environment (e.g., dev, prod) |
π€ Outputsβ
| Name | Description |
|---|---|
sqs_queue_name | The name of the created SQS queue |
sqs_queue_arn | The ARN of the created SQS queue |
sqs_queue_url | The full URL endpoint for the SQS queue |
π Deployment Readinessβ
- β Compatible with Terraform 1.0+
- β Tested with AWS provider 5.x
- π§ͺ Can be paired with Lambda, ECS, EventBridge, or Step Functions
π οΈ Example Usageβ
module "sqs_queue_standard" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//developer-utilities/sqs-queue-standard?ref=v1.0.0"
region = "us-east-1"
queue_name = "task-buffer-queue"
delay_seconds = 0
message_retention = 345600
visibility_timeout = 30
kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/abc123-example"
environment = "dev"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
π§Ή Cleanup Optionsβ
For testing:
terraform destroy
or
tofu destroy
For production:
Manually delete the queue via the AWS Console or CLI if it is actively used in workflows to avoid disrupting message delivery.
π‘οΈ Notesβ
This is a Level 1 messaging module for provisioning standard SQS queues. For strict FIFO behavior or deduplication, consider using an SQS FIFO variant. Pair with Lambda triggers, retry policies, or EventBridge rules for full system orchestration.
π Deployment Package Noticeβ
This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.