Skip to content

Instantly share code, notes, and snippets.

@yustam
Created October 18, 2014 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yustam/73545151bfff21ee4999 to your computer and use it in GitHub Desktop.
Save yustam/73545151bfff21ee4999 to your computer and use it in GitHub Desktop.
velocity-cfn-template-sample.template
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "this is my sample template.",
"Resources" : {
"SampleSG" : {
"Type" : "AWS::EC2::SecurityGroup",
"DeletionPolicy" : "Delete",
"Properties" : {
"GroupDescription" : "this is a sample.",
"SecurityGroupIngress" : [
{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "XXX.XXX.XXX.XXX" },
{ "IpProtocol" : "tcp", "FromPort" : "5432", "ToPort" : "5432", "CidrIp" : "XXX.XXX.XXX.XXX" }
]
}
},
"SampleInstance" : {
"Type" : "AWS::EC2::Instance",
"DeletionPolicy" : "Delete",
"Properties" : {
"Tags" : [
{ "Key" : "Name", "Value" : "SampleInstance" }
],
"ImageId" : "ami-00000000",
"InstanceType" : "t2.micro",
"AvailabilityZone" : "ap-notrheast-1",
"SecurityGroups" : [ { "Ref" : "SampleSG" } ],
"UserData" : { "Fn::Base64" : { "Fn::Join" : [ "", [
"#!/bin/bash -v\n",
"yum update -y aws-cfn-bootstrap\n",
"# wait for the EBS volume to show up\n",
"while [ ! -e /dev/sdh ]; do echo Waiting for EBS volume to attach; sleep 5; done\n",
"while [ ! -e /dev/sdi ]; do echo Waiting for EBS volume to attach; sleep 5; done\n",
"while [ ! -e /dev/sdj ]; do echo Waiting for EBS volume to attach; sleep 5; done\n",
"# mount EBS volume\n",
"mount /dev/sdh /var/lib/pgsql9/data1\n",
"mount /dev/sdi /var/lib/pgsql9/data2\n",
"mount /dev/sdj /var/lib/pgsql9/data3\n",
"# start postgresql server\n",
"service postgresql start\n"
]]}}
}
},
"File" : {
"Type" : "AWS::EC2::Volume",
"DeletionPolicy" : "Delete",
"Properties" : {
"AvailabilityZone" : "ap-notrheast-1",
"Encrypted" : "false",
"VolumeType" : "standard",
"Size" : "10"
}
},
"MountPointFile" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "SampleInstance" },
"VolumeId" : { "Ref" : "File" },
"Device" : "/dev/sdf"
}
},
"DatabaseVolumeDB01" : {
"Type" : "AWS::EC2::Volume",
"DeletionPolicy" : "Delete",
"Properties" : {
"AvailabilityZone" : "ap-notrheast-1",
"SnapshotId" : "snap-00000001",
"Encrypted" : "false",
"VolumeType" : "standard",
"Size" : "10"
}
},
"MountPointDB01" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "SampleInstance" },
"VolumeId" : { "Ref" : "DatabaseVolumeDB01" },
"Device" : "/dev/sdh"
}
},
"DatabaseVolumeDB02" : {
"Type" : "AWS::EC2::Volume",
"DeletionPolicy" : "Delete",
"Properties" : {
"AvailabilityZone" : "ap-notrheast-1",
"SnapshotId" : "snap-00000002",
"Encrypted" : "false",
"VolumeType" : "standard",
"Size" : "10"
}
},
"MountPointDB02" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "SampleInstance" },
"VolumeId" : { "Ref" : "DatabaseVolumeDB02" },
"Device" : "/dev/sdi"
}
},
"DatabaseVolumeDB03" : {
"Type" : "AWS::EC2::Volume",
"DeletionPolicy" : "Delete",
"Properties" : {
"AvailabilityZone" : "ap-notrheast-1",
"SnapshotId" : "snap-00000003",
"Encrypted" : "false",
"VolumeType" : "standard",
"Size" : "10"
}
},
"MountPointDB03" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "SampleInstance" },
"VolumeId" : { "Ref" : "DatabaseVolumeDB03" },
"Device" : "/dev/sdj"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment