AWSTemplateFormatVersion: 2010-09-09
Description: VPC, Subnets and EC2
Resources:
MyVpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 192.168.0.0/16
EnableDnsHostnames: true
Tags:
-
Key: Stack
Value: Test
MyVpcRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref MyVpc
MyInternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
-
Key: Stack
Name: Test
AddInternetGatewayToVpc:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref MyInternetGateway
VpcId: !Ref MyVpc
AddInternetGatewayRouteToRouteTable
Type: AWS::EC2::Route
Properties:
GatewayId: !Ref MyInternetGateway
DestinationCidrBlock: 0.0.0.0/0
RouteTableId: !Ref MyVpcRouteTable
PublicSubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref MyVpc
CidrBlock: 192.168.1.0/24
MapPublicIpOnLaunch: true
AvailabilityZoneId: euw1-az2
PrivateSubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref MyVpc
CidrBlock: 192.168.2.0/24
MapPublicIpOnLaunch: false
AvailabilityZoneId: euw1-az2
WebserverInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0ea0f26a6d50850c5
InstanceType: t2.micro
SubnetId: !Ref PublicSubnet
KeyName: !Ref MyInstanceKeyPair
MyInstanceKeyPair:
Type: AWS::EC2::KeyPair
Properties:
KeyName: MyKeyPair
uj5u.com熱心網友回復:
之后你失蹤:了AddInternetGatewayRouteToRouteTable。所以應該是:
AddInternetGatewayRouteToRouteTable:
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/515180.html
