Created
March 25, 2024 04:35
-
-
Save overnew/1e5282dc13c30ce0284d99cacf6841d9 to your computer and use it in GitHub Desktop.
CloudFormation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Deploy VPC | |
Resources: | |
PublicSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
VpcId: !Ref VPC #VPC의 ID를 참조 | |
CidrBlock: 10.0.0.0/24 #VPC 네트워크 내의 CIDR 주소를 선택 | |
AvailabilityZone: !Select #!Select는 함수로, 리전 내의 가용 영역을 검색 | |
- '0' # 검색된 영역 중에 첫번째를 선택 | |
- !GetAZs '' # 첫번째 AZ를 참조 | |
Tags: | |
- Key: Name | |
Value: Public Subnet | |
#public 서브넷은 IGW로의 경로를 설정해야 하므로 일단 생성 | |
PublicRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
VpcId: !Ref VPC | |
Tags: | |
- Key: Name | |
Value: Public Route Table | |
PublicRoute: # 라우팅 테이블에 경로를 추가 | |
Type: AWS::EC2::Route | |
Properties: | |
RouteTableId: !Ref PublicRouteTable | |
DestinationCidrBlock: 0.0.0.0/0 #모든 IP를 | |
GatewayId: !Ref InternetGateway #IGW로 | |
PublicSubnetRouteTableAssociation: # 라우팅 테이블을 subnet과 연결 | |
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