Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@Crosachi

CloudFormationでVPCを作成する

概要

CloudFormationを使ってみたかったので、試しにVPCを作成してみます。

作成するもの

  • VPC
  • サブネット

テンプレート

AWSTemplateFormatVersion: 2010-09-09
Description: >-
  CloudFormationでVPC, subnetを作成します
Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 172.16.1.0/24
      EnableDnsSupport: true
      Tags:
        - Key: Name
          Value: VPC-name
  subnet1a:
    Type: AWS::EC2::Subnet
    Properties:
      AvailabilityZone: "ap-northeast-1a"
      VpcId: 
        Ref: VPC
      CidrBlock: 172.16.1.0/26
      Tags:
        - Key: Name
          Value: subnet-1a
  subnet1c:
    Type: AWS::EC2::Subnet
    Properties:
      AvailabilityZone: "ap-northeast-1c"
      VpcId: 
        Ref: VPC
      CidrBlock: 172.16.1.64/26
      Tags:
        - Key: Name
          Value: subnet-1c

雑感

NATゲートウェイやルートテーブルも設定したいですね。
セキュリティグループは用途次第なので、作るリソースに合わせて作成ですかね。
たとえば、RDSならDBのポートを開けるとか。

資料

テンプレートを作る際のリファレンスはこちらです。
日本語だと情報がうまく出ないので英語を指定します。
https://docs.aws.amazon.com/en_us/AWSCloudFormation/latest/UserGuide/template-reference.html

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?