Created
May 31, 2018 03:03
-
-
Save spg/489f3cafec5af1a0872371cb41996b51 to your computer and use it in GitHub Desktop.
CloudFormation AMI usage example
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
MyAMI: | |
Type: Custom::AMI | |
Properties: | |
ServiceToken: !ImportValue AMILambdaFunctionArn | |
Image: | |
Name: my-image | |
Description: some description for the image | |
TemplateInstance: | |
ImageId: ami-467ca739 | |
IamInstanceProfile: | |
Arn: arn:aws:iam::1234567890:instance-profile/MyProfile-ASDNSDLKJ | |
UserData: | |
Fn::Base64: !Sub | | |
#!/bin/bash -x | |
yum -y install mysql # provisioning example | |
# Signal that the instance is ready | |
INSTANCE_ID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id` | |
aws ec2 create-tags --resources $INSTANCE_ID --tags Key=UserDataFinished,Value=true --region ${AWS::Region} | |
KeyName: my-key | |
InstanceType: t2.nano | |
SecurityGroupIds: | |
- sg-d7bf78b0 | |
SubnetId: subnet-ba03aa91 | |
BlockDeviceMappings: | |
- DeviceName: "/dev/xvda" | |
Ebs: | |
VolumeSize: '10' | |
VolumeType: gp2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment