【发布时间】:2022-01-20 23:53:06
【问题描述】:
我正在创建一条到我的互联网网关的公共路由。当我通过 GUI 进行配置时,完全没有问题。当我尝试通过我的 Cloudformation 模板执行此操作时,每次都失败。这是网关的构造,没有任何问题:
GatewayToInternet:
Type: AWS::EC2::InternetGateway
DependsOn: VPC
Properties:
Tags:
- Key: Name
Value: !Sub ${AWS::StackName}-IGW
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref GatewayToInternet
这是我附加的导致问题的路线:
PublicDefaultRoute1
Type: AWS::EC2::Route
DependsOn: GatewayToInternet
Properties:
RouteTableId: !Ref PublicRouteTable
GatewayId: !Ref GatewayToInternet
DestinationCidrBlock: 0.0.0.0/0
我从 CLI 得到的错误是:调用 CreateStack 操作时发生错误 (ValidationError):模板格式错误:YAML 格式不正确。 (第 261 行,第 5 列)
如果我删除路线,一切都会完美运行。我没有任何其他路由附加到该路由表,如果这很重要的话。
【问题讨论】:
-
您能否使用 YAML 验证器确认您的模板没有无效的 YAML 语法?编辑:没关系,我发现了问题
-
我不敢相信我错过了。谢谢!