-
-
Save winebarrel/9b9bc263c0b80b1d4ca4 to your computer and use it in GitHub Desktop.
This file contains 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
Resources do | |
[:cthulhu, :hastur, :nyar].each {|name| | |
_(name) do | |
Type "AWS::EC2::Instance" | |
Properties do | |
# amzn-ami-pv-2013.09.2.x86_64-ebs | |
ImageId "ami-0d13700c" | |
InstanceType "t1.micro" | |
KeyName "XXX" | |
NetworkInterfaces [ | |
_{ | |
DeviceIndex 0 | |
SubnetId "subnet-XXXXXXXX" | |
AssociatePublicIpAddress true | |
} | |
] | |
UserData do | |
Fn__Base64 (<<-EOS).fn_join | |
#!/bin/bash | |
/opt/aws/bin/cfn-init -s <%= Ref "AWS::StackName" %> -r #{name} --region <%= Ref "AWS::Region" %> | |
/opt/aws/bin/cfn-signal -e 0 '<%= Ref "#{name}WaitHandle" %>' | |
EOS | |
end | |
Tags [ | |
_{ | |
Key "Name" | |
Value name | |
} | |
] | |
end # Properties | |
Metadata do | |
AWS__CloudFormation__Init do | |
config do | |
commands do | |
setup_command do | |
command (<<-EOS).fn_join | |
echo `hostname` > /tmp/hostname | |
EOS | |
end | |
end | |
end | |
end | |
end | |
end | |
_("#{name}WaitHandle") do | |
Type "AWS::CloudFormation::WaitConditionHandle" | |
end | |
_("#{name}WaitCondition") do | |
Type "AWS::CloudFormation::WaitCondition" | |
DependsOn name | |
Properties do | |
Handle { Ref "#{name}WaitHandle" } | |
Timeout 300 | |
end | |
end | |
} # end of each | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment