CloudFormation Deploy Sqs пример
---
AWSTemplateFormatVersion: '2010-09-09'
Description: This stack creates a FIFO Queue
Parameters:
ContentBasedDeduplication:
Description: Specifie whether to enable content-based deduplication
Type: String
AllowedValues:
- 'true'
- 'false'
Default: 'true'
QueueName:
Description: This stack will append .fifo to the end of the Queue name.
Type: String
DelaySeconds:
Description: "The time in seconds that the delivery of all messages in the queue"
Type: Number
Default: '5'
MaximumMessageSize:
Type: Number
Description: "The limit of how many bytes that a message can contain before Amazon"
Default: '262144'
MessageRetentionPeriod:
Description: "The number of seconds that Amazon SQS retains a message."
Type: Number
Default: '345600'
ReceiveMessageWaitTimeSeconds:
Description: "Specifies the duration, in seconds, that the ReceiveMessage action
call waits until a message is in the queue in order to include it in the response"
Type: Number
Default: '0'
UsedeadletterQueue:
Description: "A dead-letter queue is a queue that other (source) queues can target
for messages that can't be processed (consumed) successfully."
Type: String
AllowedValues:
- 'true'
- 'false'
Default: 'false'
VisibilityTimeout:
Description: "This should be longer than the time it would take to process and
delete a message"
Type: Number
Default: '5'
Mappings: {}
Conditions:
CreateDeadLetterQueue:
Fn::Equals:
- Ref: UsedeadletterQueue
- 'true'
Resources:
SQSQueue:
Type: AWS::SQS::Queue
Properties:
ContentBasedDeduplication:
Ref: ContentBasedDeduplication
FifoQueue: 'true'
QueueName:
Fn::Join:
- ''
- - Ref: QueueName
- ".fifo"
MaximumMessageSize:
Ref: MaximumMessageSize
MessageRetentionPeriod:
Ref: MessageRetentionPeriod
ReceiveMessageWaitTimeSeconds:
Ref: ReceiveMessageWaitTimeSeconds
RedrivePolicy:
Fn::If:
- CreateDeadLetterQueue
- deadLetterTargetArn:
Fn::GetAtt:
- MyDeadLetterQueue
- Arn
maxReceiveCount: 5
- Ref: AWS::NoValue
VisibilityTimeout:
Ref: VisibilityTimeout
MyDeadLetterQueue:
Condition: CreateDeadLetterQueue
Type: AWS::SQS::Queue
Properties:
FifoQueue: 'true'
QueueName:
Fn::Join:
- ''
- - Ref: QueueName
- Deadletter
- ".fifo"
Outputs:
QueueURL:
Description: URL of the created SQS
Value:
Ref: SQSQueue
QueueARN:
Description: ARN of the created SQS
Value:
Fn::GetAtt:
- SQSQueue
- Arn
QueueName:
Description: Name of the created SQS
Value:
Fn::GetAtt:
- SQSQueue
- QueueName
Filthy Frog