aws-cdk
Version:
CDK Toolkit, the command line tool for CDK apps
91 lines • 2.33 kB
JSON
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template SQS_With_CloudWatch_Alarms: Sample template showing how to create an SQS queue with AWS CloudWatch alarms on queue depth.",
"Parameters": {
"AlarmEMail": {
"Description": "EMail address to notify if there are any operational issues",
"Type": "String",
"AllowedPattern": "([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)",
"ConstraintDescription": "must be a valid email address."
}
},
"Resources": {
"MyQueue": {
"Type": "AWS::SQS::Queue",
"Properties": {}
},
"AlarmTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"Subscription": [
{
"Endpoint": {
"Ref": "AlarmEMail"
},
"Protocol": "email"
}
]
}
},
"QueueDepthAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Alarm if queue depth grows beyond 10 messages",
"Namespace": "AWS/SQS",
"MetricName": "ApproximateNumberOfMessagesVisible",
"Dimensions": [
{
"Name": "QueueName",
"Value": {
"Fn::GetAtt": [
"MyQueue",
"QueueName"
]
}
}
],
"Statistic": "Sum",
"Period": "300",
"EvaluationPeriods": "1",
"Threshold": "10",
"ComparisonOperator": "GreaterThanThreshold",
"AlarmActions": [
{
"Ref": "AlarmTopic"
}
],
"InsufficientDataActions": [
{
"Ref": "AlarmTopic"
}
]
}
}
},
"Outputs": {
"QueueURL": {
"Description": "URL of newly created SQS Queue",
"Value": {
"Ref": "MyQueue"
}
},
"QueueARN": {
"Description": "ARN of newly created SQS Queue",
"Value": {
"Fn::GetAtt": [
"MyQueue",
"Arn"
]
}
},
"QueueName": {
"Description": "Name newly created SQS Queue",
"Value": {
"Fn::GetAtt": [
"MyQueue",
"QueueName"
]
}
}
}
}