Skip to content

Instantly share code, notes, and snippets.

@zugdud zugdud/simpleVPC
Last active Dec 1, 2017

Embed
What would you like to do?
simpleVPC
AWSTemplateFormatVersion: '2010-09-09'
Description: Simple VPC
Parameters:
VPCName:
Type: String
Default: My VPC
Description: Name for the VPC
Resources:
myVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/22
EnableDnsSupport: 'true'
EnableDnsHostnames: 'false'
InstanceTenancy: default
Tags:
- Key: Name
Value: !Ref VPCName
MyPublicSubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref myVPC
CidrBlock: 10.0.0.0/24
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: !Ref AWS::Region
Tags:
- Key: Name
Value: !Ref VPCName
myInternetGateway:
Type: "AWS::EC2::InternetGateway"
Properties:
Tags:
- Key: Name
Value: StagingVPCIGW
myRouteTablePublic:
Type: "AWS::EC2::RouteTable"
Properties:
VpcId: !Ref myVPC
Tags:
- Key: Name
Value: StagingVPCIGWPubRouteTable
AttachInternetGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref myVPC
InternetGatewayId: !Ref myInternetGateway
RouteDefaultPublic:
Type: "AWS::EC2::Route"
DependsOn: myInternetGateway
Properties:
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref myInternetGateway
RouteTableId: !Ref myRouteTablePublic
MyPublicSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref MyPublicSubnet
RouteTableId: !Ref myRouteTablePublic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.