Skip to main content

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​

NameTypeDescription
regionstringAWS region to deploy the queue
queue_namestringName of the SQS queue
delay_secondsnumber(Optional) Delay before message delivery (in seconds)
message_retentionnumber(Optional) How long to retain messages (in seconds)
visibility_timeoutnumber(Optional) Visibility timeout for message processing (in seconds)
kms_key_arnstring(Optional) ARN of the KMS key for encrypting queue messages
environmentstringTag to specify the deployment environment (e.g., dev, prod)

πŸ“€ Outputs​

NameDescription
sqs_queue_nameThe name of the created SQS queue
sqs_queue_arnThe ARN of the created SQS queue
sqs_queue_urlThe 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.