AWS::SQS::QueuePolicy
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
PolicyDocument
-
A policy document that contains the permissions for the specified Amazon SQS queues. For more information about Amazon SQS policies, see Using custom policies with the Amazon SQS access policy language in the Amazon SQS Developer Guide.
Required: Yes
Type: Json
Update requires: No interruption
Queues
-
The URLs of the queues to which you want to add the policy. You can use the
Ref
function to specify anAWS::SQS::Queue
resource.Required: Yes
Type: Array of String
Update requires: No interruption
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"