0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

privateVPC作成

Posted at

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作れるところまで確認

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?