lono 3.5.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +15 -4
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +15 -1
  5. data/Gemfile +3 -3
  6. data/Guardfile +17 -8
  7. data/{LICENSE → LICENSE.txt} +1 -1
  8. data/README.md +20 -12
  9. data/Rakefile +1 -2
  10. data/{bin → exe}/lono +1 -0
  11. data/lib/lono.rb +12 -9
  12. data/lib/lono/cfn.rb +7 -9
  13. data/lib/lono/cfn/{aws_services.rb → aws_service.rb} +1 -1
  14. data/lib/lono/cfn/base.rb +41 -38
  15. data/lib/lono/cfn/create.rb +6 -2
  16. data/lib/lono/cfn/delete.rb +2 -2
  17. data/lib/lono/cfn/diff.rb +1 -1
  18. data/lib/lono/cfn/preview.rb +26 -15
  19. data/lib/lono/cfn/update.rb +11 -9
  20. data/lib/lono/cfn/util.rb +3 -3
  21. data/lib/lono/clean.rb +1 -1
  22. data/lib/lono/cli.rb +71 -39
  23. data/lib/lono/command.rb +42 -18
  24. data/lib/lono/completer.rb +162 -0
  25. data/lib/lono/completer/script.rb +6 -0
  26. data/lib/lono/completer/script.sh +10 -0
  27. data/lib/lono/completion.rb +15 -0
  28. data/lib/lono/core.rb +23 -9
  29. data/lib/lono/core/config.rb +20 -0
  30. data/lib/lono/default/settings.yml +33 -13
  31. data/lib/lono/help.rb +6 -79
  32. data/lib/lono/help/cfn.md +6 -0
  33. data/lib/lono/help/cfn/create.md +22 -0
  34. data/lib/lono/help/cfn/delete.md +5 -0
  35. data/lib/lono/help/cfn/diff.md +5 -0
  36. data/lib/lono/help/cfn/download.md +5 -0
  37. data/lib/lono/help/cfn/preview.md +11 -0
  38. data/lib/lono/help/cfn/update.md +21 -0
  39. data/lib/lono/help/completion.md +22 -0
  40. data/lib/lono/help/completion_script.md +3 -0
  41. data/lib/lono/help/generate.md +7 -0
  42. data/lib/lono/help/hello.md +5 -0
  43. data/lib/lono/help/import.md +7 -0
  44. data/lib/lono/help/inspect.md +4 -0
  45. data/lib/lono/help/inspect/depends.md +3 -0
  46. data/lib/lono/help/inspect/summary.md +3 -0
  47. data/lib/lono/help/new.md +8 -0
  48. data/lib/lono/help/param.md +3 -0
  49. data/lib/lono/{param/help.rb → help/param/generate.md} +1 -9
  50. data/lib/lono/help/script/build.md +5 -0
  51. data/lib/lono/help/script/upload.md +8 -0
  52. data/lib/lono/help/template.md +4 -0
  53. data/lib/lono/help/template/bashify.md +4 -0
  54. data/lib/lono/help/template/generate.md +7 -0
  55. data/lib/lono/help/user_data.md +3 -0
  56. data/lib/lono/importer.rb +43 -20
  57. data/lib/lono/inspector.rb +2 -19
  58. data/lib/lono/inspector/base.rb +2 -2
  59. data/lib/lono/inspector/{depends.rb → graph.rb} +3 -3
  60. data/lib/lono/inspector/summary.rb +1 -1
  61. data/lib/lono/new.rb +79 -26
  62. data/lib/lono/new/helper.rb +16 -0
  63. data/lib/lono/new/message.rb +35 -0
  64. data/lib/lono/param.rb +1 -2
  65. data/lib/lono/param/generator.rb +34 -86
  66. data/lib/lono/project_checker.rb +35 -40
  67. data/lib/lono/script.rb +19 -0
  68. data/lib/lono/script/base.rb +9 -0
  69. data/lib/lono/script/build.rb +73 -0
  70. data/lib/lono/script/upload.rb +81 -0
  71. data/lib/lono/sequence.rb +33 -0
  72. data/lib/lono/setting.rb +83 -0
  73. data/lib/lono/template.rb +8 -9
  74. data/lib/lono/template/{aws_services.rb → aws_service.rb} +1 -1
  75. data/lib/lono/template/context.rb +73 -0
  76. data/lib/lono/template/dsl.rb +63 -64
  77. data/lib/lono/template/helper.rb +201 -0
  78. data/lib/lono/template/template.rb +29 -221
  79. data/lib/lono/template/upload.rb +41 -33
  80. data/lib/lono/upgrade4.rb +175 -0
  81. data/lib/lono/user_data.rb +31 -0
  82. data/lib/lono/version.rb +1 -1
  83. data/lib/starter_projects/autoscaling/.gitignore +1 -0
  84. data/lib/starter_projects/{json_project → autoscaling}/Gemfile +0 -0
  85. data/lib/starter_projects/{yaml_project → autoscaling}/Guardfile +0 -0
  86. data/lib/starter_projects/autoscaling/README.md +118 -0
  87. data/lib/starter_projects/autoscaling/app/definitions/base.rb +2 -0
  88. data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +682 -0
  89. data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +6 -0
  90. data/lib/starter_projects/autoscaling/config/settings.yml +33 -0
  91. data/lib/starter_projects/ec2/.gitignore +1 -0
  92. data/lib/starter_projects/{yaml_project → ec2}/Gemfile +0 -0
  93. data/lib/starter_projects/{json_project → ec2}/Guardfile +1 -1
  94. data/lib/starter_projects/ec2/README.md +86 -0
  95. data/lib/starter_projects/ec2/app/definitions/base.rb +2 -0
  96. data/lib/starter_projects/ec2/app/definitions/development.rb +1 -0
  97. data/lib/starter_projects/ec2/app/definitions/production.rb +1 -0
  98. data/lib/starter_projects/{yaml_project → ec2/app}/helpers/my_custom_helper.rb +0 -0
  99. data/lib/starter_projects/{json_project/templates/user_data/app.sh → ec2/app/partials/user_data/bootstrap.sh} +1 -2
  100. data/lib/starter_projects/{yaml_project → ec2/app}/templates/example.yml +0 -0
  101. data/lib/starter_projects/{json_project/params/base/api-web.txt → ec2/config/params/base/example.txt} +0 -0
  102. data/lib/starter_projects/ec2/config/params/development/example.txt +3 -0
  103. data/lib/starter_projects/ec2/config/params/production/example.txt +2 -0
  104. data/lib/starter_projects/ec2/config/settings.yml +33 -0
  105. data/lib/starter_projects/ec2/config/variables/base.rb +3 -0
  106. data/lib/starter_projects/ec2/config/variables/development.rb +2 -0
  107. data/lib/starter_projects/ec2/config/variables/production.rb +2 -0
  108. data/lib/starter_projects/ec2/welcome.txt +8 -0
  109. data/lib/starter_projects/skeleton/.gitignore +1 -0
  110. data/lib/starter_projects/skeleton/Gemfile +3 -0
  111. data/lib/starter_projects/skeleton/Guardfile +12 -0
  112. data/lib/starter_projects/skeleton/README.md +53 -0
  113. data/{spec/fixtures/my_project/templates/.gitkeep → lib/starter_projects/skeleton/app/definitions/base.rb} +0 -0
  114. data/lib/starter_projects/skeleton/config/settings.yml +33 -0
  115. data/lib/starter_projects/skeleton/welcome.txt +7 -0
  116. data/lono.gemspec +12 -10
  117. data/spec/fixtures/lono_project/.gitignore +1 -0
  118. data/spec/fixtures/lono_project/Gemfile +3 -0
  119. data/spec/fixtures/lono_project/Guardfile +12 -0
  120. data/spec/fixtures/lono_project/app/definitions/base.rb +10 -0
  121. data/spec/fixtures/lono_project/app/definitions/base/more.rb +7 -0
  122. data/spec/fixtures/lono_project/app/definitions/development.rb +1 -0
  123. data/spec/fixtures/lono_project/app/definitions/production.rb +1 -0
  124. data/spec/fixtures/lono_project/app/helpers/custom_helper.rb +5 -0
  125. data/spec/fixtures/lono_project/app/partials/security_group.yml +10 -0
  126. data/{lib/starter_projects/yaml_project/templates/partial → spec/fixtures/lono_project/app/partials}/user_data/bootstrap.sh +8 -2
  127. data/spec/fixtures/lono_project/app/templates/example.yml +50 -0
  128. data/{lib/starter_projects/yaml_project/params/base/api-web-prod.txt → spec/fixtures/lono_project/config/params/base/example.txt} +1 -0
  129. data/spec/fixtures/lono_project/config/params/development/example.txt +1 -0
  130. data/spec/fixtures/lono_project/config/params/production/example.txt +1 -0
  131. data/spec/fixtures/lono_project/config/settings.yml +31 -0
  132. data/spec/fixtures/lono_project/config/variables/base.rb +3 -0
  133. data/spec/fixtures/lono_project/config/variables/development.rb +1 -0
  134. data/spec/fixtures/lono_project/config/variables/production.rb +1 -0
  135. data/spec/fixtures/params/envonly/params/{prod → development}/network.txt +0 -0
  136. data/spec/fixtures/params/overlay/params/{prod → development}/network.txt +0 -0
  137. data/spec/fixtures/raw_templates/aws-waf-security-automations.template +2 -2
  138. data/spec/lib/lono/cfn_spec.rb +6 -9
  139. data/spec/lib/lono/cli_spec.rb +44 -0
  140. data/spec/lib/lono/completion_spec.rb +17 -0
  141. data/spec/lib/lono/inspect_spec.rb +6 -15
  142. data/spec/lib/lono/param/generator_spec.rb +45 -26
  143. data/spec/lib/lono/param_spec.rb +1 -3
  144. data/spec/lib/lono/setting_spec.rb +47 -0
  145. data/spec/lib/lono/template/dsl_spec.rb +33 -157
  146. data/spec/lib/lono/template_spec.rb +4 -16
  147. data/spec/spec_helper.rb +45 -14
  148. metadata +168 -82
  149. data/.coveralls.yml +0 -1
  150. data/lib/lono/cfn/help.rb +0 -103
  151. data/lib/lono/current_region.rb +0 -42
  152. data/lib/lono/inspector/help.rb +0 -21
  153. data/lib/lono/settings.rb +0 -45
  154. data/lib/lono/template/help.rb +0 -25
  155. data/lib/lono/template/helpers.rb +0 -136
  156. data/lib/starter_projects/json_project/.gitignore +0 -1
  157. data/lib/starter_projects/json_project/config/templates/base/blog.rb +0 -20
  158. data/lib/starter_projects/json_project/config/templates/base/stacks.rb +0 -58
  159. data/lib/starter_projects/json_project/templates/db.json +0 -212
  160. data/lib/starter_projects/json_project/templates/partial/host_record.json +0 -28
  161. data/lib/starter_projects/json_project/templates/partial/server.json +0 -45
  162. data/lib/starter_projects/json_project/templates/user_data/db.sh +0 -39
  163. data/lib/starter_projects/json_project/templates/user_data/db2.sh +0 -2
  164. data/lib/starter_projects/json_project/templates/user_data/ruby_script.rb +0 -5
  165. data/lib/starter_projects/json_project/templates/web.json +0 -386
  166. data/lib/starter_projects/yaml_project/.gitignore +0 -1
  167. data/lib/starter_projects/yaml_project/config/templates/base/blog.rb +0 -20
  168. data/lib/starter_projects/yaml_project/config/templates/base/stacks.rb +0 -56
  169. data/lib/starter_projects/yaml_project/config/templates/prod/stacks.rb +0 -1
  170. data/lib/starter_projects/yaml_project/config/templates/stag/stacks.rb +0 -1
  171. data/lib/starter_projects/yaml_project/config/variables/base/variables.rb +0 -4
  172. data/lib/starter_projects/yaml_project/config/variables/prod/variables.rb +0 -1
  173. data/lib/starter_projects/yaml_project/config/variables/stag/variables.rb +0 -1
  174. data/lib/starter_projects/yaml_project/params/base/example.txt +0 -2
  175. data/lib/starter_projects/yaml_project/params/prod/example.txt +0 -1
  176. data/lib/starter_projects/yaml_project/params/stag/example.txt +0 -1
  177. data/lib/starter_projects/yaml_project/templates/db.yml +0 -148
  178. data/lib/starter_projects/yaml_project/templates/partial/host_record.yml +0 -14
  179. data/lib/starter_projects/yaml_project/templates/partial/server.yml +0 -59
  180. data/lib/starter_projects/yaml_project/templates/web.yml +0 -206
  181. data/spec/fixtures/my_project/config/templates/base/stacks.rb +0 -3
  182. data/spec/fixtures/my_project/params/my-stack.txt +0 -3
  183. data/spec/fixtures/my_project/templates/my-stack.yml +0 -0
  184. data/spec/lib/lono/new_spec.rb +0 -59
  185. data/spec/lib/lono/template/template_spec.rb +0 -104
  186. data/spec/lib/lono_spec.rb +0 -27
@@ -0,0 +1,2 @@
1
+
2
+ template "autoscaling"
@@ -0,0 +1,682 @@
1
+ ---
2
+ AWSTemplateFormatVersion: '2010-09-09'
3
+ Description: 'AWS CloudFormation Sample Template AutoScalingMultiAZWithNotifications:
4
+ Create a multi-az, load balanced and Auto Scaled sample web site running on an Apache
5
+ Web Serever. The application is configured to span all Availability Zones in the
6
+ region and is Auto-Scaled based on the CPU utilization of the web servers. Notifications
7
+ will be sent to the operator email address on scaling events. The instances are
8
+ load balanced with a simple health check against the default web page. **WARNING**
9
+ This template creates one or more Amazon EC2 instances and an Application Load Balancer.
10
+ You will be billed for the AWS resources used if you create a stack from this template.'
11
+ Parameters:
12
+ VpcId:
13
+ Type: AWS::EC2::VPC::Id
14
+ Description: VpcId of your existing Virtual Private Cloud (VPC)
15
+ ConstraintDescription: must be the VPC Id of an existing Virtual Private Cloud.
16
+ Subnets:
17
+ Type: List<AWS::EC2::Subnet::Id>
18
+ Description: The list of SubnetIds in your Virtual Private Cloud (VPC)
19
+ ConstraintDescription: must be a list of at least two existing subnets associated
20
+ with at least two different availability zones. They should be residing in the
21
+ selected Virtual Private Cloud.
22
+ InstanceType:
23
+ Description: WebServer EC2 instance type
24
+ Type: String
25
+ Default: t2.small
26
+ AllowedValues:
27
+ - t1.micro
28
+ - t2.nano
29
+ - t2.micro
30
+ - t2.small
31
+ - t2.medium
32
+ - t2.large
33
+ - m1.small
34
+ - m1.medium
35
+ - m1.large
36
+ - m1.xlarge
37
+ - m2.xlarge
38
+ - m2.2xlarge
39
+ - m2.4xlarge
40
+ - m3.medium
41
+ - m3.large
42
+ - m3.xlarge
43
+ - m3.2xlarge
44
+ - m4.large
45
+ - m4.xlarge
46
+ - m4.2xlarge
47
+ - m4.4xlarge
48
+ - m4.10xlarge
49
+ - c1.medium
50
+ - c1.xlarge
51
+ - c3.large
52
+ - c3.xlarge
53
+ - c3.2xlarge
54
+ - c3.4xlarge
55
+ - c3.8xlarge
56
+ - c4.large
57
+ - c4.xlarge
58
+ - c4.2xlarge
59
+ - c4.4xlarge
60
+ - c4.8xlarge
61
+ - g2.2xlarge
62
+ - g2.8xlarge
63
+ - r3.large
64
+ - r3.xlarge
65
+ - r3.2xlarge
66
+ - r3.4xlarge
67
+ - r3.8xlarge
68
+ - i2.xlarge
69
+ - i2.2xlarge
70
+ - i2.4xlarge
71
+ - i2.8xlarge
72
+ - d2.xlarge
73
+ - d2.2xlarge
74
+ - d2.4xlarge
75
+ - d2.8xlarge
76
+ - hi1.4xlarge
77
+ - hs1.8xlarge
78
+ - cr1.8xlarge
79
+ - cc2.8xlarge
80
+ - cg1.4xlarge
81
+ ConstraintDescription: must be a valid EC2 instance type.
82
+ OperatorEMail:
83
+ Description: EMail address to notify if there are any scaling operations
84
+ Type: String
85
+ 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})(\\]?)"
86
+ ConstraintDescription: must be a valid email address.
87
+ KeyName:
88
+ Description: The EC2 Key Pair to allow SSH access to the instances
89
+ Type: AWS::EC2::KeyPair::KeyName
90
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
91
+ SSHLocation:
92
+ Description: The IP address range that can be used to SSH to the EC2 instances
93
+ Type: String
94
+ MinLength: '9'
95
+ MaxLength: '18'
96
+ Default: 0.0.0.0/0
97
+ AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})"
98
+ ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
99
+ Mappings:
100
+ Region2Examples:
101
+ us-east-1:
102
+ Examples: https://s3.amazonaws.com/cloudformation-examples-us-east-1
103
+ us-west-2:
104
+ Examples: https://s3-us-west-2.amazonaws.com/cloudformation-examples-us-west-2
105
+ us-west-1:
106
+ Examples: https://s3-us-west-1.amazonaws.com/cloudformation-examples-us-west-1
107
+ eu-west-1:
108
+ Examples: https://s3-eu-west-1.amazonaws.com/cloudformation-examples-eu-west-1
109
+ eu-west-2:
110
+ Examples: https://s3-eu-west-2.amazonaws.com/cloudformation-examples-eu-west-2
111
+ eu-west-3:
112
+ Examples: https://s3-eu-west-3.amazonaws.com/cloudformation-examples-eu-west-3
113
+ eu-central-1:
114
+ Examples: https://s3-eu-central-1.amazonaws.com/cloudformation-examples-eu-central-1
115
+ ap-southeast-1:
116
+ Examples: https://s3-ap-southeast-1.amazonaws.com/cloudformation-examples-ap-southeast-1
117
+ ap-northeast-1:
118
+ Examples: https://s3-ap-northeast-1.amazonaws.com/cloudformation-examples-ap-northeast-1
119
+ ap-northeast-2:
120
+ Examples: https://s3-ap-northeast-2.amazonaws.com/cloudformation-examples-ap-northeast-2
121
+ ap-northeast-3:
122
+ Examples: https://s3-ap-northeast-3.amazonaws.com/cloudformation-examples-ap-northeast-3
123
+ ap-southeast-2:
124
+ Examples: https://s3-ap-southeast-2.amazonaws.com/cloudformation-examples-ap-southeast-2
125
+ ap-south-1:
126
+ Examples: https://s3-ap-south-1.amazonaws.com/cloudformation-examples-ap-south-1
127
+ us-east-2:
128
+ Examples: https://s3-us-east-2.amazonaws.com/cloudformation-examples-us-east-2
129
+ ca-central-1:
130
+ Examples: https://s3-ca-central-1.amazonaws.com/cloudformation-examples-ca-central-1
131
+ sa-east-1:
132
+ Examples: https://s3-sa-east-1.amazonaws.com/cloudformation-examples-sa-east-1
133
+ cn-north-1:
134
+ Examples: https://s3.cn-north-1.amazonaws.com.cn/cloudformation-examples-cn-north-1
135
+ cn-northwest-1:
136
+ Examples: https://s3.cn-northwest-1.amazonaws.com.cn/cloudformation-examples-cn-northwest-1
137
+ AWSInstanceType2Arch:
138
+ t1.micro:
139
+ Arch: PV64
140
+ t2.nano:
141
+ Arch: HVM64
142
+ t2.micro:
143
+ Arch: HVM64
144
+ t2.small:
145
+ Arch: HVM64
146
+ t2.medium:
147
+ Arch: HVM64
148
+ t2.large:
149
+ Arch: HVM64
150
+ m1.small:
151
+ Arch: PV64
152
+ m1.medium:
153
+ Arch: PV64
154
+ m1.large:
155
+ Arch: PV64
156
+ m1.xlarge:
157
+ Arch: PV64
158
+ m2.xlarge:
159
+ Arch: PV64
160
+ m2.2xlarge:
161
+ Arch: PV64
162
+ m2.4xlarge:
163
+ Arch: PV64
164
+ m3.medium:
165
+ Arch: HVM64
166
+ m3.large:
167
+ Arch: HVM64
168
+ m3.xlarge:
169
+ Arch: HVM64
170
+ m3.2xlarge:
171
+ Arch: HVM64
172
+ m4.large:
173
+ Arch: HVM64
174
+ m4.xlarge:
175
+ Arch: HVM64
176
+ m4.2xlarge:
177
+ Arch: HVM64
178
+ m4.4xlarge:
179
+ Arch: HVM64
180
+ m4.10xlarge:
181
+ Arch: HVM64
182
+ c1.medium:
183
+ Arch: PV64
184
+ c1.xlarge:
185
+ Arch: PV64
186
+ c3.large:
187
+ Arch: HVM64
188
+ c3.xlarge:
189
+ Arch: HVM64
190
+ c3.2xlarge:
191
+ Arch: HVM64
192
+ c3.4xlarge:
193
+ Arch: HVM64
194
+ c3.8xlarge:
195
+ Arch: HVM64
196
+ c4.large:
197
+ Arch: HVM64
198
+ c4.xlarge:
199
+ Arch: HVM64
200
+ c4.2xlarge:
201
+ Arch: HVM64
202
+ c4.4xlarge:
203
+ Arch: HVM64
204
+ c4.8xlarge:
205
+ Arch: HVM64
206
+ g2.2xlarge:
207
+ Arch: HVMG2
208
+ g2.8xlarge:
209
+ Arch: HVMG2
210
+ r3.large:
211
+ Arch: HVM64
212
+ r3.xlarge:
213
+ Arch: HVM64
214
+ r3.2xlarge:
215
+ Arch: HVM64
216
+ r3.4xlarge:
217
+ Arch: HVM64
218
+ r3.8xlarge:
219
+ Arch: HVM64
220
+ i2.xlarge:
221
+ Arch: HVM64
222
+ i2.2xlarge:
223
+ Arch: HVM64
224
+ i2.4xlarge:
225
+ Arch: HVM64
226
+ i2.8xlarge:
227
+ Arch: HVM64
228
+ d2.xlarge:
229
+ Arch: HVM64
230
+ d2.2xlarge:
231
+ Arch: HVM64
232
+ d2.4xlarge:
233
+ Arch: HVM64
234
+ d2.8xlarge:
235
+ Arch: HVM64
236
+ hi1.4xlarge:
237
+ Arch: HVM64
238
+ hs1.8xlarge:
239
+ Arch: HVM64
240
+ cr1.8xlarge:
241
+ Arch: HVM64
242
+ cc2.8xlarge:
243
+ Arch: HVM64
244
+ AWSInstanceType2NATArch:
245
+ t1.micro:
246
+ Arch: NATPV64
247
+ t2.nano:
248
+ Arch: NATHVM64
249
+ t2.micro:
250
+ Arch: NATHVM64
251
+ t2.small:
252
+ Arch: NATHVM64
253
+ t2.medium:
254
+ Arch: NATHVM64
255
+ t2.large:
256
+ Arch: NATHVM64
257
+ m1.small:
258
+ Arch: NATPV64
259
+ m1.medium:
260
+ Arch: NATPV64
261
+ m1.large:
262
+ Arch: NATPV64
263
+ m1.xlarge:
264
+ Arch: NATPV64
265
+ m2.xlarge:
266
+ Arch: NATPV64
267
+ m2.2xlarge:
268
+ Arch: NATPV64
269
+ m2.4xlarge:
270
+ Arch: NATPV64
271
+ m3.medium:
272
+ Arch: NATHVM64
273
+ m3.large:
274
+ Arch: NATHVM64
275
+ m3.xlarge:
276
+ Arch: NATHVM64
277
+ m3.2xlarge:
278
+ Arch: NATHVM64
279
+ m4.large:
280
+ Arch: NATHVM64
281
+ m4.xlarge:
282
+ Arch: NATHVM64
283
+ m4.2xlarge:
284
+ Arch: NATHVM64
285
+ m4.4xlarge:
286
+ Arch: NATHVM64
287
+ m4.10xlarge:
288
+ Arch: NATHVM64
289
+ c1.medium:
290
+ Arch: NATPV64
291
+ c1.xlarge:
292
+ Arch: NATPV64
293
+ c3.large:
294
+ Arch: NATHVM64
295
+ c3.xlarge:
296
+ Arch: NATHVM64
297
+ c3.2xlarge:
298
+ Arch: NATHVM64
299
+ c3.4xlarge:
300
+ Arch: NATHVM64
301
+ c3.8xlarge:
302
+ Arch: NATHVM64
303
+ c4.large:
304
+ Arch: NATHVM64
305
+ c4.xlarge:
306
+ Arch: NATHVM64
307
+ c4.2xlarge:
308
+ Arch: NATHVM64
309
+ c4.4xlarge:
310
+ Arch: NATHVM64
311
+ c4.8xlarge:
312
+ Arch: NATHVM64
313
+ g2.2xlarge:
314
+ Arch: NATHVMG2
315
+ g2.8xlarge:
316
+ Arch: NATHVMG2
317
+ r3.large:
318
+ Arch: NATHVM64
319
+ r3.xlarge:
320
+ Arch: NATHVM64
321
+ r3.2xlarge:
322
+ Arch: NATHVM64
323
+ r3.4xlarge:
324
+ Arch: NATHVM64
325
+ r3.8xlarge:
326
+ Arch: NATHVM64
327
+ i2.xlarge:
328
+ Arch: NATHVM64
329
+ i2.2xlarge:
330
+ Arch: NATHVM64
331
+ i2.4xlarge:
332
+ Arch: NATHVM64
333
+ i2.8xlarge:
334
+ Arch: NATHVM64
335
+ d2.xlarge:
336
+ Arch: NATHVM64
337
+ d2.2xlarge:
338
+ Arch: NATHVM64
339
+ d2.4xlarge:
340
+ Arch: NATHVM64
341
+ d2.8xlarge:
342
+ Arch: NATHVM64
343
+ hi1.4xlarge:
344
+ Arch: NATHVM64
345
+ hs1.8xlarge:
346
+ Arch: NATHVM64
347
+ cr1.8xlarge:
348
+ Arch: NATHVM64
349
+ cc2.8xlarge:
350
+ Arch: NATHVM64
351
+ AWSRegionArch2AMI:
352
+ us-east-1:
353
+ PV64: ami-2a69aa47
354
+ HVM64: ami-6869aa05
355
+ HVMG2: ami-0a6e3770
356
+ us-west-2:
357
+ PV64: ami-7f77b31f
358
+ HVM64: ami-7172b611
359
+ HVMG2: ami-ee15a196
360
+ us-west-1:
361
+ PV64: ami-a2490dc2
362
+ HVM64: ami-31490d51
363
+ HVMG2: ami-0da4a46d
364
+ eu-west-1:
365
+ PV64: ami-4cdd453f
366
+ HVM64: ami-f9dd458a
367
+ HVMG2: ami-af8013d6
368
+ eu-west-2:
369
+ PV64: NOT_SUPPORTED
370
+ HVM64: ami-886369ec
371
+ HVMG2: NOT_SUPPORTED
372
+ eu-west-3:
373
+ PV64: NOT_SUPPORTED
374
+ HVM64: NOT_SUPPORTED
375
+ HVMG2: NOT_SUPPORTED
376
+ eu-central-1:
377
+ PV64: ami-6527cf0a
378
+ HVM64: ami-ea26ce85
379
+ HVMG2: ami-1d58ca72
380
+ ap-northeast-1:
381
+ PV64: ami-3e42b65f
382
+ HVM64: ami-374db956
383
+ HVMG2: ami-edfd658b
384
+ ap-northeast-2:
385
+ PV64: NOT_SUPPORTED
386
+ HVM64: ami-2b408b45
387
+ HVMG2: NOT_SUPPORTED
388
+ ap-northeast-3:
389
+ PV64: NOT_SUPPORTED
390
+ HVM64: NOT_SUPPORTED
391
+ HVMG2: NOT_SUPPORTED
392
+ ap-southeast-1:
393
+ PV64: ami-df9e4cbc
394
+ HVM64: ami-a59b49c6
395
+ HVMG2: ami-c06013bc
396
+ ap-southeast-2:
397
+ PV64: ami-63351d00
398
+ HVM64: ami-dc361ebf
399
+ HVMG2: ami-85ef12e7
400
+ ap-south-1:
401
+ PV64: NOT_SUPPORTED
402
+ HVM64: ami-ffbdd790
403
+ HVMG2: ami-411e492e
404
+ us-east-2:
405
+ PV64: NOT_SUPPORTED
406
+ HVM64: ami-f6035893
407
+ HVMG2: NOT_SUPPORTED
408
+ ca-central-1:
409
+ PV64: NOT_SUPPORTED
410
+ HVM64: ami-730ebd17
411
+ HVMG2: NOT_SUPPORTED
412
+ sa-east-1:
413
+ PV64: ami-1ad34676
414
+ HVM64: ami-6dd04501
415
+ HVMG2: NOT_SUPPORTED
416
+ cn-north-1:
417
+ PV64: ami-77559f1a
418
+ HVM64: ami-8e6aa0e3
419
+ HVMG2: NOT_SUPPORTED
420
+ cn-northwest-1:
421
+ PV64: ami-80707be2
422
+ HVM64: ami-cb858fa9
423
+ HVMG2: NOT_SUPPORTED
424
+ Resources:
425
+ NotificationTopic:
426
+ Type: AWS::SNS::Topic
427
+ Properties:
428
+ Subscription:
429
+ - Endpoint:
430
+ Ref: OperatorEMail
431
+ Protocol: email
432
+ WebServerGroup:
433
+ Type: AWS::AutoScaling::AutoScalingGroup
434
+ Properties:
435
+ VPCZoneIdentifier:
436
+ Ref: Subnets
437
+ LaunchConfigurationName:
438
+ Ref: LaunchConfig
439
+ MinSize: '1'
440
+ MaxSize: '3'
441
+ TargetGroupARNs:
442
+ - Ref: ALBTargetGroup
443
+ NotificationConfiguration:
444
+ TopicARN:
445
+ Ref: NotificationTopic
446
+ NotificationTypes:
447
+ - autoscaling:EC2_INSTANCE_LAUNCH
448
+ - autoscaling:EC2_INSTANCE_LAUNCH_ERROR
449
+ - autoscaling:EC2_INSTANCE_TERMINATE
450
+ - autoscaling:EC2_INSTANCE_TERMINATE_ERROR
451
+ CreationPolicy:
452
+ ResourceSignal:
453
+ Timeout: PT15M
454
+ Count: '1'
455
+ UpdatePolicy:
456
+ AutoScalingRollingUpdate:
457
+ MinInstancesInService: '1'
458
+ MaxBatchSize: '1'
459
+ PauseTime: PT15M
460
+ WaitOnResourceSignals: 'true'
461
+ LaunchConfig:
462
+ Type: AWS::AutoScaling::LaunchConfiguration
463
+ Metadata:
464
+ Comment: Install a simple application
465
+ AWS::CloudFormation::Init:
466
+ config:
467
+ packages:
468
+ yum:
469
+ httpd: []
470
+ files:
471
+ "/var/www/html/index.html":
472
+ content:
473
+ Fn::Join:
474
+ - "\n"
475
+ - - <img src="
476
+ - Fn::FindInMap:
477
+ - Region2Examples
478
+ - Ref: AWS::Region
479
+ - Examples
480
+ - /cloudformation_graphic.png" alt="AWS CloudFormation Logo"/>
481
+ - "<h1>Congratulations, you have successfully launched the AWS CloudFormation
482
+ sample.</h1>"
483
+ mode: '000644'
484
+ owner: root
485
+ group: root
486
+ "/etc/cfn/cfn-hup.conf":
487
+ content:
488
+ Fn::Join:
489
+ - ''
490
+ - - "[main]\n"
491
+ - stack=
492
+ - Ref: AWS::StackId
493
+ - "\n"
494
+ - region=
495
+ - Ref: AWS::Region
496
+ - "\n"
497
+ mode: '000400'
498
+ owner: root
499
+ group: root
500
+ "/etc/cfn/hooks.d/cfn-auto-reloader.conf":
501
+ content:
502
+ Fn::Join:
503
+ - ''
504
+ - - "[cfn-auto-reloader-hook]\n"
505
+ - 'triggers=post.update
506
+
507
+ '
508
+ - 'path=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init
509
+
510
+ '
511
+ - 'action=/opt/aws/bin/cfn-init -v '
512
+ - " --stack "
513
+ - Ref: AWS::StackName
514
+ - " --resource LaunchConfig "
515
+ - " --region "
516
+ - Ref: AWS::Region
517
+ - "\n"
518
+ - 'runas=root
519
+
520
+ '
521
+ mode: '000400'
522
+ owner: root
523
+ group: root
524
+ services:
525
+ sysvinit:
526
+ httpd:
527
+ enabled: 'true'
528
+ ensureRunning: 'true'
529
+ cfn-hup:
530
+ enabled: 'true'
531
+ ensureRunning: 'true'
532
+ files:
533
+ - "/etc/cfn/cfn-hup.conf"
534
+ - "/etc/cfn/hooks.d/cfn-auto-reloader.conf"
535
+ Properties:
536
+ KeyName:
537
+ Ref: KeyName
538
+ ImageId:
539
+ Fn::FindInMap:
540
+ - AWSRegionArch2AMI
541
+ - Ref: AWS::Region
542
+ - Fn::FindInMap:
543
+ - AWSInstanceType2Arch
544
+ - Ref: InstanceType
545
+ - Arch
546
+ SecurityGroups:
547
+ - Ref: InstanceSecurityGroup
548
+ InstanceType:
549
+ Ref: InstanceType
550
+ UserData:
551
+ Fn::Base64:
552
+ Fn::Join:
553
+ - ''
554
+ - - "#!/bin/bash -xe\n"
555
+ - 'yum update -y aws-cfn-bootstrap
556
+
557
+ '
558
+ - 'yum update -y aws-cli
559
+
560
+ '
561
+ - "/opt/aws/bin/cfn-init -v "
562
+ - " --stack "
563
+ - Ref: AWS::StackName
564
+ - " --resource LaunchConfig "
565
+ - " --region "
566
+ - Ref: AWS::Region
567
+ - "\n"
568
+ - "/opt/aws/bin/cfn-signal -e $? "
569
+ - " --stack "
570
+ - Ref: AWS::StackName
571
+ - " --resource WebServerGroup "
572
+ - " --region "
573
+ - Ref: AWS::Region
574
+ - "\n"
575
+ WebServerScaleUpPolicy:
576
+ Type: AWS::AutoScaling::ScalingPolicy
577
+ Properties:
578
+ AdjustmentType: ChangeInCapacity
579
+ AutoScalingGroupName:
580
+ Ref: WebServerGroup
581
+ Cooldown: '60'
582
+ ScalingAdjustment: '1'
583
+ WebServerScaleDownPolicy:
584
+ Type: AWS::AutoScaling::ScalingPolicy
585
+ Properties:
586
+ AdjustmentType: ChangeInCapacity
587
+ AutoScalingGroupName:
588
+ Ref: WebServerGroup
589
+ Cooldown: '60'
590
+ ScalingAdjustment: "-1"
591
+ CPUAlarmHigh:
592
+ Type: AWS::CloudWatch::Alarm
593
+ Properties:
594
+ AlarmDescription: Scale-up if CPU > 90% for 10 minutes
595
+ MetricName: CPUUtilization
596
+ Namespace: AWS/EC2
597
+ Statistic: Average
598
+ Period: '300'
599
+ EvaluationPeriods: '2'
600
+ Threshold: '90'
601
+ AlarmActions:
602
+ - Ref: WebServerScaleUpPolicy
603
+ Dimensions:
604
+ - Name: AutoScalingGroupName
605
+ Value:
606
+ Ref: WebServerGroup
607
+ ComparisonOperator: GreaterThanThreshold
608
+ CPUAlarmLow:
609
+ Type: AWS::CloudWatch::Alarm
610
+ Properties:
611
+ AlarmDescription: Scale-down if CPU < 70% for 10 minutes
612
+ MetricName: CPUUtilization
613
+ Namespace: AWS/EC2
614
+ Statistic: Average
615
+ Period: '300'
616
+ EvaluationPeriods: '2'
617
+ Threshold: '70'
618
+ AlarmActions:
619
+ - Ref: WebServerScaleDownPolicy
620
+ Dimensions:
621
+ - Name: AutoScalingGroupName
622
+ Value:
623
+ Ref: WebServerGroup
624
+ ComparisonOperator: LessThanThreshold
625
+ ApplicationLoadBalancer:
626
+ Type: AWS::ElasticLoadBalancingV2::LoadBalancer
627
+ Properties:
628
+ Subnets:
629
+ Ref: Subnets
630
+ ALBListener:
631
+ Type: AWS::ElasticLoadBalancingV2::Listener
632
+ Properties:
633
+ DefaultActions:
634
+ - Type: forward
635
+ TargetGroupArn:
636
+ Ref: ALBTargetGroup
637
+ LoadBalancerArn:
638
+ Ref: ApplicationLoadBalancer
639
+ Port: '80'
640
+ Protocol: HTTP
641
+ ALBTargetGroup:
642
+ Type: AWS::ElasticLoadBalancingV2::TargetGroup
643
+ Properties:
644
+ HealthCheckIntervalSeconds: 30
645
+ HealthCheckTimeoutSeconds: 5
646
+ HealthyThresholdCount: 3
647
+ Port: 80
648
+ Protocol: HTTP
649
+ UnhealthyThresholdCount: 5
650
+ VpcId:
651
+ Ref: VpcId
652
+ InstanceSecurityGroup:
653
+ Type: AWS::EC2::SecurityGroup
654
+ Properties:
655
+ GroupDescription: Enable SSH access and HTTP from the load balancer only
656
+ SecurityGroupIngress:
657
+ - IpProtocol: tcp
658
+ FromPort: '22'
659
+ ToPort: '22'
660
+ CidrIp:
661
+ Ref: SSHLocation
662
+ - IpProtocol: tcp
663
+ FromPort: '80'
664
+ ToPort: '80'
665
+ SourceSecurityGroupId:
666
+ Fn::Select:
667
+ - 0
668
+ - Fn::GetAtt:
669
+ - ApplicationLoadBalancer
670
+ - SecurityGroups
671
+ VpcId:
672
+ Ref: VpcId
673
+ Outputs:
674
+ URL:
675
+ Description: The URL of the website
676
+ Value:
677
+ Fn::Join:
678
+ - ''
679
+ - - http://
680
+ - Fn::GetAtt:
681
+ - ApplicationLoadBalancer
682
+ - DNSName