-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathci_rr_launch.yaml
221 lines (220 loc) · 7.2 KB
/
ci_rr_launch.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
AWSTemplateFormatVersion: '2010-09-09'
Description: CFT to launch Cloud Insight Remediation Report resources
Parameters:
pProjectName:
Description: Prefix name that will be used across all resource name
AllowedPattern: "^[A-Za-z][A-Za-z0-9_-]*$"
ConstraintDescription: Project name must only contain alpha numeric, - and _
MaxLength: 40
Type: String
pFrequency:
Description: How often the check should run (specify in hours)
Default: 24
Type: String
pDestS3Bucket:
Description: The S3 bucket name where you wish to store the output, leave it empty if you want to automatically create the S3 bucket
Type: String
pTTL:
Description: Attribute name for time to live settings, warning changing this may require update to DynamoDB and Lambda
Type: String
Default: 'TTL'
pAtRestEncryption:
Description: Set to True if you want to enable at rest encryption on S3 and DynamoDB
Type: String
AllowedValues: [true, false]
Default: true
pStandardBaseReadCapacity:
Description: DynamoDB minimum provisioned read capacity for non critical table
Type: String
Default: 5
pStandardBaseWriteCapacity:
Description: DynamoDB minimum provisioned write capacity for non critical table
Type: String
Default: 5
pBaseReadCapacity:
Description: DynamoDB table minimum provisioned read capacity
Type: String
Default: 50
pBaseWriteCapacity:
Description: DynamoDB table minimum provisioned write capacity
Type: String
Default: 50
pMaxReadCapacity:
Description: DynamoDB table maximum provisioned read capacity
Type: String
Default: 500
pMaxWriteCapacity:
Description: DynamoDB table maxium provisioned write capacity
Type: String
Default: 500
pLambdaInvokeMode:
Description: Lambda Invoke Mode (Event / RequestResponse)
Type: String
AllowedValues: [Event, RequestResponse]
Default: 'Event'
pLambdaPackages:
Description: Lambda package which implement the report
Default: "ci_rr_lambda.zip"
Type: String
pSourceS3Bucket:
Description: >
The prefix of the S3 bucket which contains Lambda package. Note that the name of the bucket must contain a region name suffix. The following is the valid backet name syntax: <bucket_name_prefix>.us-east-1.
Default: "al-deployment-services"
Type: String
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: "Project Configuration"
Parameters:
- pProjectName
- pDestS3Bucket
- pAtRestEncryption
- pFrequency
-
Label:
default: "DynamoDB Configuration"
Parameters:
- pStandardBaseReadCapacity
- pStandardBaseWriteCapacity
- pBaseReadCapacity
- pBaseWriteCapacity
- pMaxReadCapacity
- pMaxWriteCapacity
- pTTL
-
Label:
default: "Lambda Configuration"
Parameters:
- pLambdaInvokeMode
- pLambdaPackages
- pSourceS3Bucket
ParameterLabels:
pProjectName:
default: "Project Name"
pDestS3Bucket:
default: "Output S3 Bucket"
pAtRestEncryption:
default: "Encryption (at rest)"
pFrequency:
default: "Rate of checks"
pStandardBaseReadCapacity:
default: "Read capacity (non critical table)"
pStandardBaseWriteCapacity:
default: "Write capacity (non critical table)"
pBaseReadCapacity:
default: "Read capacity (critical table)"
pBaseWriteCapacity:
default: "Write capacity (critical table)"
pMaxReadCapacity:
default: "Max read capacity (all table)"
pMaxWriteCapacity:
default: "Max write capacity (all table)"
pTTL:
default: "TTL attribute name"
pLambdaInvokeMode:
default: "Invoke Mode"
pLambdaPackages:
default: "Package name"
pSourceS3Bucket:
default: "Source S3 Bucket"
Conditions:
CreateBucket: !Equals
- ''
- !Ref pDestS3Bucket
Mappings:
YarpMap:
ASHBURN:
"yarp": "api.cloudinsight.alertlogic.com"
DENVER:
"yarp": "api.cloudinsight.alertlogic.com"
NEWPORT:
"yarp": "api.cloudinsight.alertlogic.co.uk"
Resources:
OutputBucket:
DeletionPolicy: Retain
Condition: CreateBucket
Type: AWS::S3::Bucket
Properties:
AccessControl: Private
DynamoDBStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
ProjectName: !Ref pProjectName
TTL: !Ref pTTL
AtRestEncryption: !Ref pAtRestEncryption
StandardBaseReadCapacity: !Ref pStandardBaseReadCapacity
StandardBaseWriteCapacity: !Ref pStandardBaseWriteCapacity
BaseReadCapacity: !Ref pBaseReadCapacity
BaseWriteCapacity: !Ref pBaseWriteCapacity
MaxReadCapacity: !Ref pMaxReadCapacity
MaxWriteCapacity: !Ref pMaxWriteCapacity
TemplateURL: !Join
- ''
- - "https://s3.amazonaws.com/"
- !Ref 'pSourceS3Bucket'
- "."
- !Ref 'AWS::Region'
- "/cloud_formations/ci_rr_launch_dynamodb_stack.yaml"
LambdaStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
pProjectName: !Ref pProjectName
pDestS3Bucket: !If [CreateBucket, !Ref 'OutputBucket', !Ref 'pDestS3Bucket']
pLambdaInvokeMode: !Ref pLambdaInvokeMode
pLambdaPackages: !Ref pLambdaPackages
pSourceS3Bucket: !Ref pSourceS3Bucket
pDynamoDBStack: !GetAtt [DynamoDBStack, Outputs.StackName]
TemplateURL: !Join
- ''
- - "https://s3.amazonaws.com/"
- !Ref 'pSourceS3Bucket'
- "."
- !Ref 'AWS::Region'
- "/cloud_formations/ci_rr_launch_lambda_stack.yaml"
ApiGatewayStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
pProjectName: !Ref pProjectName
pLambdaStack: !GetAtt [LambdaStack, Outputs.StackName]
TemplateURL: !Join
- ''
- - "https://s3.amazonaws.com/"
- !Ref 'pSourceS3Bucket'
- "."
- !Ref 'AWS::Region'
- "/cloud_formations/ci_rr_launch_api_gateway_stack.yaml"
EventStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
pProjectName: !Ref pProjectName
pLambdaStack: !GetAtt [LambdaStack, Outputs.StackName]
pFrequency: !Ref pFrequency
TemplateURL: !Join
- ''
- - "https://s3.amazonaws.com/"
- !Ref 'pSourceS3Bucket'
- "."
- !Ref 'AWS::Region'
- "/cloud_formations/ci_rr_launch_event_stack.yaml"
Outputs:
OutputBucket:
Description: Output from the function will be made avalable in this S3 bucket.
Value: !Ref OutputBucket
OutputSNSTopic:
Description: SNS topic for output notification.
Value: !GetAtt LambdaStack.Outputs.OutputSNSTopic
APIUsagePlan:
Description: Please create API Key in this Usage Plan
Value: !GetAtt ApiGatewayStack.Outputs.APIUsagePlan
APIKey:
Description: From AWS Console copy the Key value from this API Key
Value: !GetAtt ApiGatewayStack.Outputs.APIKey
RegisterURL:
Description: Use this URL to register new CID
Value: !GetAtt ApiGatewayStack.Outputs.RegisterURL