Skip to content

Commit 8b62d3e

Browse files
committed
adds elastic ip
1 parent 47e4de8 commit 8b62d3e

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

ec2-ubuntu-nginx-php.json

+32-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@
1111
"Description": "Define o estado de ambiente do servidor",
1212
"Default": "dev",
1313
"Type": "String",
14-
"AllowedValues": ["prod", "dev"],
14+
"AllowedValues": [
15+
"prod",
16+
"dev"
17+
],
1518
"ConstraintDescription": "precisa ser prod ou dev"
1619
},
17-
"SSHLocation" : {
18-
"Description" : "Define o range de IPs que podem acessar o SSH do servidor",
20+
"SSHLocation": {
21+
"Description": "Define o range de IPs que podem acessar o SSH do servidor",
1922
"Type": "String",
2023
"MinLength": "9",
2124
"MaxLength": "18",
2225
"Default": "0.0.0.0/0",
2326
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
2427
"ConstraintDescription": "precisa ser um range de IP CIDR validos x.x.x.x/x."
25-
}
28+
}
2629
},
2730
"Resources": {
2831
"RootRole": {
@@ -85,6 +88,14 @@
8588
]
8689
}
8790
},
91+
"ElasticIP": {
92+
"Type": "AWS::EC2::EIP",
93+
"Properties": {
94+
"InstanceId": {
95+
"Ref": "EC2InstanceWeb"
96+
}
97+
}
98+
},
8899
"SecurityGroupWebTraffic": {
89100
"Type": "AWS::EC2::SecurityGroup",
90101
"Properties": {
@@ -94,7 +105,9 @@
94105
"IpProtocol": "tcp",
95106
"FromPort": 22,
96107
"ToPort": 22,
97-
"CidrIp": {"Ref" : "SSHLocation"},
108+
"CidrIp": {
109+
"Ref": "SSHLocation"
110+
},
98111
"Description": "SSH traffic"
99112
},
100113
{
@@ -128,15 +141,19 @@
128141
],
129142
"ImageId": "ami-0bbe28eb2173f6167",
130143
"InstanceType": "t2.micro",
131-
"KeyName": { "Ref" : "KeyName" },
144+
"KeyName": {
145+
"Ref": "KeyName"
146+
},
132147
"Tags": [
133148
{
134149
"Key": "Name",
135150
"Value": "nginx-server"
136151
},
137152
{
138153
"Key": "EnvironmentType",
139-
"Value": { "Ref" : "EnvironmentType" }
154+
"Value": {
155+
"Ref": "EnvironmentType"
156+
}
140157
}
141158
],
142159
"NetworkInterfaces": [
@@ -188,5 +205,13 @@
188205
}
189206
}
190207
}
208+
},
209+
"Outputs": {
210+
"ElasticIPV4": {
211+
"Description": "Retorna o valor do IP registrado para a instancia",
212+
"Value": {
213+
"Ref": "ElasticIP"
214+
}
215+
}
191216
}
192217
}

0 commit comments

Comments
 (0)