Answers:
不,您不能,无论如何都没有要引用的内容(例如逻辑ID)。只需创建您自己的主表;-)。
这可能是无法使用的原因之一:
保护VPC的一种方法是将主路由表保留为其原始默认状态(仅具有本地路由),并将 创建的每个新子网与已创建的自定义路由表之一明确关联。这样可确保您必须明确控制每个子网的出站流量的路由方式。
如果需要通过CloudFormation实施该设置,则可以自己定义每个组件。只需创建自己的VPC,Internet网关,子网和路由表。然后,您需要为特定子网显式声明RouteTableAssociation,并为该表创建一条公共路由。这是一个例子
AWSTemplateFormatVersion: '2010-09-09'
Description: Example
Resources:
myInternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: "Name"
Value: "a_gateway"
myVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/24
EnableDnsSupport: true
EnableDnsHostnames: true
InstanceTenancy: default
# Attach Internet gateway to created VPC
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
Ref: myVPC
InternetGatewayId:
Ref: myInternetGateway
# Create public routes table for VPC
myPublicRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref myVPC
Tags:
- Key: "Name"
Value: "public_routes"
# Create a route for the table which will forward the traffic
# from the gateway
myDefaultPublicRoute:
Type: AWS::EC2::Route
DependsOn: AttachGateway
Properties:
RouteTableId: !Ref myPublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref myInternetGateway
# Subnet within VPC which will use route table (with default route)
# from Internet gateway
mySubnet:
Type: AWS::EC2::Subnet
Properties:
AvailabilityZone: ""
CidrBlock: 10.0.0.0/25
MapPublicIpOnLaunch: true
VpcId:
Ref: myVPC
# Associate route table (which contains default route) to newly created subnet
myPublicRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref myPublicRouteTable
SubnetId: !Ref mySubnet
这样,您将能够使用创建的路由表(在上面的示例中,该表用于从Internet Gateway转发流量)