Skip to content

Instantly share code, notes, and snippets.

@gcanales75
Created July 24, 2016 01:51
Show Gist options
  • Select an option

  • Save gcanales75/a4225ca337757d4d2a10881a35524794 to your computer and use it in GitHub Desktop.

Select an option

Save gcanales75/a4225ca337757d4d2a10881a35524794 to your computer and use it in GitHub Desktop.
Crear un VPC y 2 subnet, una publica y una privada con parametros
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Crear un VPC y 2 subnet, una publica y una privada",
"Parameters" : {
"AZ" : {
"Type" : "String",
"Default" : "us-east-1a",
"AllowedValues" : ["us-east-1a", "us-east-1c", "us-east-1d", "us-east-1e"],
"Description" : "Especificar Availability Zone."
},
"CIDRVPC" : {
"Type" : "String",
"Description" : "Especificar CIDR para la VPC (ej. 10.0.0.0/16)"
},
"CIDRPublicSubnet" : {
"Type" : "String",
"Description" : "Especificar CIDR para la Subnet Publica (ej. 10.0.0.0/16)"
},
"CIDRPrivateSubnet" : {
"Type" : "String",
"Description" : "Especificar CIDR para la Subnet Privada (ej. 10.0.0.0/16)"
}
},
"Resources" : {
"VPC" : {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"EnableDnsSupport" : "true",
"EnableDnsHostnames" : "true",
"CidrBlock" : { "Ref" : "CIDRVPC" },
"Tags" : [
{ "Key" : "Name", "Value" : { "Ref" : "AWS::StackName" } },
{ "Key" : "Network", "Value" : "Public" }
]
}
},
"PublicSubnet" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"AvailabilityZone" : { "Ref" : "AZ" },
"VpcId" : { "Ref" : "VPC" },
"CidrBlock" : { "Ref" : "CIDRPublicSubnet" },
"Tags" : [
{ "Key" : "Network", "Value" : "Public" },
{ "Key" : "Name", "Value" : "public-subnet" }
]
}
},
"PrivateSubnet" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"AvailabilityZone" : { "Ref" : "AZ" },
"VpcId" : { "Ref" : "VPC" },
"CidrBlock" : { "Ref" : "CIDRPrivateSubnet" },
"Tags" : [
{ "Key" : "Network", "Value" : "Private" },
{ "Key" : "Name", "Value" : "private-subnet" }
]
}
},
"InternetGateway" : {
"Type" : "AWS::EC2::InternetGateway"
},
"GatewayToInternet" : {
"Type" : "AWS::EC2::VPCGatewayAttachment",
"Properties" : {
"VpcId" : { "Ref" : "VPC" },
"InternetGatewayId" : { "Ref" : "InternetGateway" }
}
},
"PublicRouteTable" : {
"Type" : "AWS::EC2::RouteTable",
"Properties" : {
"VpcId" : { "Ref" : "VPC" }
}
},
"PublicRoute" : {
"Type" : "AWS::EC2::Route",
"DependsOn" : "GatewayToInternet",
"Properties" : {
"RouteTableId" : { "Ref" : "PublicRouteTable" },
"DestinationCidrBlock" : "0.0.0.0/0",
"GatewayId" : { "Ref" : "InternetGateway" }
}
},
"PublicSubnetRouteTableAssociation" : {
"Type" : "AWS::EC2::SubnetRouteTableAssociation",
"Properties" : {
"SubnetId" : { "Ref" : "PublicSubnet" },
"RouteTableId" : { "Ref" : "PublicRouteTable" }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment