AWS::SQS::QueuePolicy - AWS CloudFormation (original) (raw)

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.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "Type" : "AWS::SQS::QueuePolicy",
  "Properties" : {
      "PolicyDocument" : Json,
      "Queues" : [ String, ... ]
    }
}

YAML

Type: AWS::SQS::QueuePolicy
Properties:
  PolicyDocument: Json
  Queues: 
    - String

Properties

Return values

Fn::GetAtt

Id

The provider-assigned unique ID for this managed resource.

Examples

Amazon SQS Queue Policy

The following sample is a queue policy that allows AWS account 111122223333 to send and receive messages on queue queue2. You add the policy to the resources section of your template.

JSON

 
"SampleSQSPolicy" : {
  "Type" : "AWS::SQS::QueuePolicy",
  "Properties" : {
    "Queues" :  ["https://sqs:us-east-2.amazonaws.com/444455556666/queue2"],
    "PolicyDocument": {
      "Statement":[{
        "Action":["SQS:SendMessage", "SQS:ReceiveMessage"],
        "Effect":"Allow",
        "Resource": "arn:aws:sqs:us-east-2:444455556666:queue2",
        "Principal": {
          "AWS": [
            "111122223333"]
        }
      }]
    }
  }
}     
      

YAML

 
SampleSQSPolicy: 
  Type: AWS::SQS::QueuePolicy
  Properties: 
    Queues: 
      - "https://sqs:us-east-2.amazonaws.com/444455556666/queue2"
    PolicyDocument: 
      Statement: 
        - 
          Action: 
            - "SQS:SendMessage" 
            - "SQS:ReceiveMessage"
          Effect: "Allow"
          Resource: "arn:aws:sqs:us-east-2:444455556666:queue2"
          Principal:  
            AWS: 
              - "111122223333"