AWSTemplateFormatVersion: "2010-09-09"
Description:
VPC and Subnet Create
Metadata:
"AWS::CloudFormation::Interface":
ParameterGroups:
- Label:
default: "Project Name Prefix"
Parameters:
- atai
- Label:
default: "Network Configuration"
Parameters:
- VPCCIDR
- PrivateSubnetCIDR
ParameterLabels:
VPCCIDR:
default: "VPC CIDR"
PrivateSubnetIDR:
default: "PrivateSubnet CIDR"
# ------------------------------------------------------------#
# Input Parameters
# ------------------------------------------------------------#
Parameters:
atai:
Type: String
VPCCIDR:
Type: String
Default: "10.1.0.0/16"
PrivateSubnetCIDR:
Type: String
Default: "10.1.200.0/24"
Resources:
# ------------------------------------------------------------#
# VPC
# ------------------------------------------------------------#
# VPC Create
VPC:
Type: "AWS::EC2::VPC"
Properties:
CidrBlock: !Ref VPCCIDR
EnableDnsSupport: "true"
EnableDnsHostnames: "true"
InstanceTenancy: default
Tags:
- Key: Name
Value: !Sub "${atai}-vpc"
# ------------------------------------------------------------#
# Subnet
# ------------------------------------------------------------#
# Private RouteTable Create
PrivateRouteTable:
Type: "AWS::EC2::RouteTable"
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: !Sub "${atai}-private-route"
# ------------------------------------------------------------#
# Routing
# ------------------------------------------------------------#
# None
# ------------------------------------------------------------#
# RouteTable Associate
# ------------------------------------------------------------#
# PrivateRouteTable Associate Subnet
PrivateSubnetCRouteTableAssociation:
Type: "AWS::EC2::SubnetRouteTableAssociation"
Properties:
SubnetId: !Ref PrivateSubnet
RouteTableId: !Ref PrivateRouteTable
# ------------------------------------------------------------#
# Output Parameters
# ------------------------------------------------------------#
Outputs:
# VPC
VPC:
Value: !Ref VPC
Export:
Name: !Sub "${atai}-vpc"
VPCCIDR:
Value: !Ref VPCCIDR
Export:
Name: !Sub "${atai}-vpc-cidr"
# Subnet
PrivateSubnet:
Value: !Ref PrivateSubnet
Export:
Name: !Sub "${atai}-private-subnet"
PrivateSubnetCIDR:
Value: !Ref PrivateSubnetCIDR
Export:
Name: !Sub "${atai}-private-subnet-cidr"
# Route
PrivateRouteTable:
Value: !Ref PrivateRouteTable
Export:
Name: !Sub "${atai}-private-route"
VPC作れるところまで確認