AWS Amazon SQS Queue

This page shows how to write Terraform and CloudFormation for Amazon SQS Queue and write them securely.

aws_sqs_queue (Terraform)

The Queue in Amazon SQS can be configured in Terraform with the resource name aws_sqs_queue. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

AWS::SQS::Queue (CloudFormation)

The Queue in SQS can be configured in CloudFormation with the resource name AWS::SQS::Queue. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

queue.yml#L4
    Type: AWS::SQS::Queue
    Properties:
      QueueName: ${self:custom.config.sqs.queues.clip.name}
      VisibilityTimeout: 30
      RedrivePolicy:
        deadLetterTargetArn:
aws-resources.yml#L4
    Type: 'AWS::SQS::Queue'
    Properties:
      VisibilityTimeout: 300
      ReceiveMessageWaitTimeSeconds: 20

  TagProcessingQueue:
needs-sqs.yml#L3
    Type: AWS::SQS::Queue
    Properties:
      QueueName: ${self:service}-${self:provider.stage}-need-queue
      RedrivePolicy:
        deadLetterTargetArn: !GetAtt
          - NeedSQSQueueDLQ
task-exec-queues.yml#L3
    Type: "AWS::SQS::Queue"
    Properties:
      QueueName: "${self:custom.createTaskQueue}"
  ProcessTaskTriggerQueue:
    Type: "AWS::SQS::Queue"
    Properties:
eu-mws-notif-queues%2Btopic.yml#L2
  Type: AWS::SQS::Queue
  Properties:
    QueueName: mws-report-sub-DE
MwsReportSubPolicyDE:
  Type: AWS::SQS::QueuePolicy
  Properties:
clouformation%20step01.json#L5
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "INV_CLOSE_CASHIER",
        "DelaySeconds": "0",
        "MaximumMessageSize": "262144",
        "MessageRetentionPeriod": "86400",
sqs_queue_with_wildcards.json#L4
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "queue1"
      }
    },

sqs_queue_with_wildcards.json#L4
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "queue1"
      }
    },
    "mysqspolicy1": {
sqs_queue_with_wildcards.json#L4
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "queue1"
      }
    },

sqs_queue_with_wildcards.json#L4
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "queue1"
      }
    },

Parameters

Explanation in CloudFormation Registry

The AWS::SQS::Queue resource creates an Amazon SQS standard or FIFO queue.

Keep the following caveats in mind:+ If you don't specify the FifoQueue property, Amazon SQS creates a standard queue.

Note You can't change the queue type after you create it and you can't convert an existing standard queue into a FIFO queue. You must either create a new FIFO queue for your application or delete your existing standard queue and recreate it as a FIFO queue. For more information, see Moving from a standard queue to a FIFO queue in the Amazon SQS Developer Guide.

  • If you don't provide a value for a property, the queue is created with the default value for the property.
    • If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name.

    • To successfully create a new queue, you must provide a queue name that adheres to the limits related to queues and is unique within the scope of your queues.

    For more information about creating FIFO (first-in-first-out) queues, see Creating an Amazon SQS queue (AWS CloudFormation) in the Amazon SQS Developer Guide.

Frequently asked questions

What is AWS Amazon SQS Queue?

AWS Amazon SQS Queue is a resource for Amazon SQS of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon SQS Queue?

For CloudFormation, the fortniteclipz-com/ts_infra, nasa/earthdata-search and drobinki/needs-typescript source code examples are useful. See the CloudFormation Example section for further details.