This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mappings: | |
RegionMap: | |
us-east-1: | |
32: "ami-6411e20d" | |
64: "ami-7a11e213" | |
us-west-1: | |
32: "ami-c9c7978c" | |
64: "ami-cfc7978a" | |
Resources: | |
myEC2Instance: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ aws cloudformation create-stack --stack-name ec2-$(date +%s) --template-body file://ec2-join-tag-example.yml --parameters file://params-app-role-env.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parameters: | |
App: | |
Description: "Examples: blog, api" | |
Type: String | |
Env: | |
Description: "Examples: prod, stag, dev" | |
Type: String | |
Role: | |
Description: "Examples: web, worker, scheduler" | |
Type: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[app, env, role].join('-') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ aws cloudformation create-stack --stack-name ec2-$(date +%s) --template-body file://ec2-if-env-is-prod.yml --parameters "ParameterKey=Env,ParameterValue=prod" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parameters: | |
LargerInstance: | |
Description: Whether a larger instance should be used | |
Default: false | |
Type: String | |
AllowedValues: [true, false] | |
Resources: | |
EC2Instance: | |
Type: AWS::EC2::Instance | |
Properties: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if env == “prod” | |
# create a large m4.large instance for production environment | |
else | |
# create a small t2.micro instance for development environment | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y = x | |
x = 1 | |
print(y) # => prints 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 1 | |
y = x | |
print(y) # => prints 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ aws cloudformation create-stack --stack-name ec2-$(date +%s) --template-body file://ec2-param.yml --parameters file://params.json |