-
Notifications
You must be signed in to change notification settings - Fork 267
/
cfn-template.yaml
85 lines (85 loc) · 1.97 KB
/
cfn-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
AWSTemplateFormatVersion: 2010-09-09
Resources:
Queue:
Type: 'AWS::SQS::Queue'
Properties:
MessageRetentionPeriod: 300
SqsManagedSseEnabled: true
QueuePolicy:
Type: 'AWS::SQS::QueuePolicy'
Properties:
Queues:
- !Ref Queue
PolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- events.amazonaws.com
- sqs.amazonaws.com
Action: 'sqs:SendMessage'
Resource: !GetAtt Queue.Arn
ASGTermRule:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.autoscaling
detail-type:
- EC2 Instance-terminate Lifecycle Action
Targets:
- Id: 1
Arn: !GetAtt Queue.Arn
ScheduledChangeRule:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.health
detail-type:
- AWS Health Event
detail:
service:
- EC2
eventTypeCategory:
- scheduledChange
Targets:
- Id: 1
Arn: !GetAtt Queue.Arn
SpotTermRule:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.ec2
detail-type:
- EC2 Spot Instance Interruption Warning
Targets:
- Id: 1
Arn: !GetAtt Queue.Arn
RebalanceRule:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.ec2
detail-type:
- EC2 Instance Rebalance Recommendation
Targets:
- Id: 1
Arn: !GetAtt Queue.Arn
InstanceStateChangeRule:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.ec2
detail-type:
- EC2 Instance State-change Notification
Targets:
- Id: 1
Arn: !GetAtt Queue.Arn
Outputs:
QueueURL:
Description: Queue url for AWS NTH controller
Value: !Ref Queue