forked from nlf11/AWS-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEC2.json
162 lines (145 loc) · 4.82 KB
/
EC2.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "This Template includes Safepay Bastion Host resources provisining",
"Parameters": {
"BastionHostInstanceType": {
"Description": "The EC2 instance type",
"Type": "String",
"Default": "t2.micro",
"AllowedValues": [
"t2.medium",
"t2.micro",
"t2.large"
],
"ConstraintDescription": "must be a valid EC2 instance type."
},
"KeyName": {
"Type": "AWS::EC2::KeyPair::KeyName",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the EC2 instances"
},
"ImageID": {
"Description": "Enter the Image ID",
"Type": "String",
"ConstraintDescription": "must be a valid Image ID."
},
"BastionHostAllocatedStorage": {
"Description": "EBS Volume Size in GB",
"Type": "Number",
"Default": "8",
"AllowedValues": [
"8",
"20",
"30",
"60"
],
"ConstraintDescription": "must be between 8 and 60GB."
},
"BastionHostServerVolume": {
"Description": "EBS Volume Type",
"Type": "String",
"Default": "gp2",
"ConstraintDescription": "must be valid EBS Storage Type."
},
"VPC": {
"Type": "AWS::EC2::VPC::Id",
"Description": "Name of an existing VPC in your Region"
},
"PublicSubnet1": {
"Type": "AWS::EC2::Subnet::Id",
"Description": "Select 1st Public Subnet fom your existing VPC"
}
},
"Resources": {
"BastionHostSG": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"GroupDescription": "SG For BastionHost"
}
},
"BastionHostserver": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId" : {"Ref":"ImageID"},
"KeyName" : {"Ref":"KeyName"},
"SecurityGroupIds": [{"Ref":"BastionHostSG"}],
"InstanceType" : {"Ref":"BastionHostInstanceType"},
"SubnetId": { "Ref" : "PublicSubnet1" },
"Tags" : [
{
"Key" : "Name",
"Value" : {"Ref" : "VPC"}
}
],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"VolumeType": {
"Ref": "BastionHostServerVolume"
},
"DeleteOnTermination": "true",
"VolumeSize": {
"Ref": "BastionHostAllocatedStorage"
}
}
}
]
}
},
"EIP":{
"Type" : "AWS::EC2::EIP",
"Properties" : {
"InstanceId" : {"Ref":"BastionHostserver"}
}
},
"egress1": {
"Type": "AWS::EC2::SecurityGroupEgress",
"Properties": {
"GroupId": {
"Ref": "BastionHostSG"
},
"IpProtocol": "-1",
"CidrIp": "0.0.0.0/0"
}
},
"Port80": {
"Type": "AWS::EC2::SecurityGroupIngress",
"Properties": {
"GroupId": {
"Ref": "BastionHostSG"
},
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80",
"CidrIp": "0.0.0.0/0"
}
},
"Port22": {
"Type": "AWS::EC2::SecurityGroupIngress",
"Properties": {
"GroupId": {
"Ref": "BastionHostSG"
},
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": "0.0.0.0/0"
}
},
"ingress1": {
"Type": "AWS::EC2::SecurityGroupIngress",
"Properties": {
"GroupId": {
"Ref": "BastionHostSG"
},
"IpProtocol": "icmp",
"FromPort": "-1",
"ToPort" : "-1",
"CidrIp": "0.0.0.0/0"
}
}
}
}