AWS Amazon SQS Queue Policy

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

aws_sqs_queue_policy (Terraform)

The Queue Policy in Amazon SQS can be configured in Terraform with the resource name aws_sqs_queue_policy. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "aws_sqs_queue_policy" "valid_sqs_policy_condition" {
  queue_url = "SampleQueue"

  policy = <<EOF
  "Version": "2012-10-17",
resource "aws_sqs_queue_policy" "mo" {
  queue_url =
  policy    =

data "aws_iam_policy_document" "mo" {
resource "aws_sqs_queue_policy" "sqs_policy_allow_no_wildcard" {
  queue_url = ""
  policy    = <<EOF
    "Version": "2012-10-17",
    "Statement": [


Explanation in Terraform Registry

Allows you to set a policy of an SQS Queue while referencing ARN of the queue within the policy.

AWS::SQS::QueuePolicy (CloudFormation)

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


Explanation in CloudFormation Registry

The AWS::SQS::QueuePolicy type applies a policy to Amazon SQS queues. For an example snippet, see Declaring an Amazon SQS policy in the AWS CloudFormation User Guide.

Frequently asked questions

What is AWS Amazon SQS Queue Policy?

AWS Amazon SQS Queue Policy 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 Policy?

For Terraform, the Cigna/confectionery, rock7/cloudloop-sqs-terraform-module and ffsclyh/config-lint source code examples are useful. See the Terraform Example section for further details.