Repository navigation
Expand file tree
/
Copy pathaws-cfn.json
More file actions
85 lines (84 loc) · 3.29 KB
/
Copy pathaws-cfn.json
File metadata and controls
85 lines (84 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"SecurityGroups" : [ "www" ],
"KeyName" : "pb-syd",
"Tags" : [ { "Key" : "Name", "Value" : "meatballs" },
{ "Key" : "Environment", "Value" : "test" },
{ "Key" : "AdminGroup", "Value" : "admin" } ],
"ImageId" : "ami-e9e675d3",
"InstanceType" : "t1.micro",
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex","\n",
"apt-get --yes --quiet update\n",
"apt-get --yes --quiet install python-setuptools\n",
"apt-get --yes --quiet install git\n",
"apt-get --yes --quiet install make\n",
"easy_install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
"su - ubuntu\n",
"cd /home/ubuntu\n",
"sudo curl https://s3-ap-southeast-2.amazonaws.com/paulb67/node_bootstrap.sh | bash\n",
"git clone https://github.com/paulb67/meatballs.git\n",
"cd meatballs\n",
"sudo bash bootstrap.sh\n",
"chown -R ubuntu:ubuntu /home/ubuntu/* \n",
"/usr/local/bin/cfn-init --region ", { "Ref" : "AWS::Region" },
" -s ", { "Ref" : "AWS::StackName" }, " -r Ec2Instance\n",
"cfn-signal -e $? '", { "Ref" : "WaitForInstanceWaitHandle" }, "'\n"
]]}}
},
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"apt" : {
"git" : []
}
}
}
}
}
},
"VpcIPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "Ec2Instance" },
"AllocationId" : "eipalloc-cb5c49a9"
}
},
"WaitForInstanceWaitHandle" : {
"Type" : "AWS::CloudFormation::WaitConditionHandle",
"Properties" : {
}
},
"WaitForInstance" : {
"Type" : "AWS::CloudFormation::WaitCondition",
"DependsOn" : "Ec2Instance",
"Properties" : {
"Handle" : {"Ref" : "WaitForInstanceWaitHandle"},
"Timeout" : "300"
}
}
},
"Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Ec2Instance" }
},
"AZ" : {
"Description" : "Availability Zone of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] }
},
"PublicIP" : {
"Description" : "Public IP address of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] }
},
"PrivateIP" : {
"Description" : "Private IP address of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateIp" ] }
}
}
}