-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.json
93 lines (93 loc) · 3.11 KB
/
template.json
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
86
87
88
89
90
91
92
93
{
"Resources": {
"Ec2Instance": {
"Properties": {
"IamInstanceProfile": {
"Ref": "PugInstanceProfile"
},
"ImageId": "ami-11032472",
"InstanceType": "t2.micro",
"KeyName": "cpug",
"SecurityGroups": [
{
"Ref": "HTTPSecurityGroup"
}
],
"UserData": {
"Fn::Base64": "#!/bin/bash\n# install web server\nyum install httpd -y\naws s3 cp s3://cpug/image.png /var/www/icons/image.png\necho \"<img src='../icons/image.png'>\" > /var/www/html/index.html\nservice httpd start"
}
},
"Type": "AWS::EC2::Instance"
},
"HTTPSecurityGroup": {
"Properties": {
"GroupDescription": "Enable HTTP access via port 80",
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"FromPort": "80",
"IpProtocol": "tcp",
"ToPort": "80"
},
{
"CidrIp": "0.0.0.0/0",
"FromPort": "22",
"IpProtocol": "tcp",
"ToPort": "22"
}
]
},
"Type": "AWS::EC2::SecurityGroup"
},
"PugInstanceProfile": {
"Properties": {
"Path": "/",
"Roles": [
{
"Ref": "PugRole"
}
]
},
"Type": "AWS::IAM::InstanceProfile"
},
"PugRole": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"ec2.amazonaws.com"
]
}
}
]
},
"Path": "/",
"Policies": [
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::cpug/*"
]
}
]
},
"PolicyName": "PugPolicy"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}