VPC 생성

VPC 생성 CloudFormation 구문
VPC: # VPC 타입 설정 Type: AWS::EC2::VPC Properties: # IPv4 CIDR 블록 지정 CidrBlock: 10.0.0.0/16 # DNS 설정 EnableDnsSupport: true EnableDnsHostName: true # 이름 태그 Tags: - Key: Name Value: VPC |
서브넷 생성


PublicSubnet: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC CidrBlock: 10.0.0.0/24 AvailAbilityZone: !Select [ 0, !GetAZs '' ] Tags: - Key: Name Value: Public-Subnet |
라우팅 테이블 생성

PublicRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC Tags: - Key: Name Value: Public-RT |
라우팅 테이블과 서브넷 연결




PublicSNRouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PublicRouteTable SubnetId: !Ref PublicSubnet |
인터넷 게이트웨이 생성

InternetGateway: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Name Value: AWS-IGW |
인터넷 게이트웨이와 VPC 연결



VPCInternetGatewayAttachment: Type: AWS::EC2::VPCInternetGatewayAttachment Properties: VpcId: !Ref VPC InternetGatewayId: !Ref InternetGateway |
인터넷게이트웨이와 라우팅테이블 연결




PublicRoute: Type: AWS::EC2::Route DependsOn: VPCInternetAttachment Properties: RouteTableId: !Ref PublicRouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref InternetGateway |
'클라우드 > AWS' 카테고리의 다른 글
AWS S3 (0) | 2022.02.02 |
---|---|
Route53 정책 (0) | 2022.02.02 |
AWS - IGW 와 NAT (0) | 2021.10.20 |
AWS - 라우터와 라우팅 테이블이란? (0) | 2021.10.20 |
AWS - 서브넷이란? (0) | 2021.10.20 |