@mapbox/cloudfriend
Version:
Helper functions for assembling CloudFormation templates in JavaScript
107 lines • 2.39 kB
JSON
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {},
"Parameters": {},
"Rules": {},
"Mappings": {},
"Conditions": {},
"Resources": {
"MyQueue": {
"Type": "AWS::SQS::Queue",
"Properties": {
"MessageRetentionPeriod": 1209600,
"QueueName": {
"Fn::Sub": "${AWS::StackName}-MyQueue"
},
"RedrivePolicy": {
"maxReceiveCount": 10,
"deadLetterTargetArn": {
"Fn::GetAtt": [
"MyQueueDeadLetter",
"Arn"
]
}
},
"VisibilityTimeout": 300
}
},
"MyQueueDeadLetter": {
"Type": "AWS::SQS::Queue",
"Properties": {
"MessageRetentionPeriod": 1209600,
"VisibilityTimeout": 300,
"QueueName": {
"Fn::Sub": [
"${queue}-dead-letter",
{
"queue": {
"Fn::Sub": "${AWS::StackName}-MyQueue"
}
}
]
}
}
},
"MyQueueTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"TopicName": {
"Fn::Sub": "${AWS::StackName}-MyQueue"
}
}
},
"MyQueueSubscription": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "sqs",
"TopicArn": {
"Ref": "MyQueueTopic"
},
"Endpoint": {
"Fn::GetAtt": [
"MyQueue",
"Arn"
]
}
}
},
"MyQueuePolicy": {
"Type": "AWS::SQS::QueuePolicy",
"Properties": {
"Queues": [
{
"Ref": "MyQueue"
}
],
"PolicyDocument": {
"Version": "2008-10-17",
"Id": "MyQueue",
"Statement": [
{
"Sid": "MyQueue",
"Effect": "Allow",
"Action": "sqs:SendMessage",
"Principal": {
"AWS": "*"
},
"Resource": {
"Fn::GetAtt": [
"MyQueue",
"Arn"
]
},
"Condition": {
"ArnEquals": {
"aws:SourceArn": {
"Ref": "MyQueueTopic"
}
}
}
}
]
}
}
}
},
"Outputs": {}
}