UNPKG

@mapbox/cloudfriend

Version:

Helper functions for assembling CloudFormation templates in JavaScript

121 lines 2.71 kB
{ "AWSTemplateFormatVersion": "2010-09-09", "Metadata": {}, "Parameters": {}, "Rules": {}, "Mappings": {}, "Conditions": { "Always": { "Fn::Equals": [ "1", "1" ] } }, "Resources": { "AnotherThing": { "Type": "AWS::SNS::Topic" }, "MyQueue": { "Type": "AWS::SQS::Queue", "Condition": "Always", "DependsOn": "AnotherThing", "Properties": { "DelaySeconds": 60, "KmsMasterKeyId": "alias/my-key", "MaximumMessageSize": 1024, "MessageRetentionPeriod": 60, "QueueName": "my-queue", "ReceiveMessageWaitTimeSeconds": 20, "RedrivePolicy": { "maxReceiveCount": 100, "deadLetterTargetArn": { "Fn::GetAtt": [ "MyQueueDeadLetter", "Arn" ] } }, "VisibilityTimeout": 60 } }, "MyQueueDeadLetter": { "Type": "AWS::SQS::Queue", "Condition": "Always", "Properties": { "MessageRetentionPeriod": 1209600, "VisibilityTimeout": 60, "QueueName": { "Fn::Sub": [ "${queue}-dead-letter", { "queue": "my-queue" } ] } } }, "MyQueueTopic": { "Type": "AWS::SNS::Topic", "Condition": "Always", "Properties": { "TopicName": "my-topic", "DisplayName": "topic-display-name" } }, "MyQueueSubscription": { "Type": "AWS::SNS::Subscription", "Properties": { "Protocol": "sqs", "TopicArn": { "Ref": "MyQueueTopic" }, "Endpoint": { "Fn::GetAtt": [ "MyQueue", "Arn" ] } } }, "MyQueuePolicy": { "Type": "AWS::SQS::QueuePolicy", "Condition": "Always", "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": {} }