gpt4 book ai didi

amazon-web-services - 模板包含错误:模板格式错误:YAML 格式不正确。 (第 30 行,第 9 列)即 Type: AWS::EC2::Route 行

转载 作者:行者123 更新时间:2023-12-03 07:22:20 25 4
gpt4 key购买 nike

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

最佳答案

您在 AddInternetGatewayRouteToRouteTable 之后缺少 :。所以应该是:

AddInternetGatewayRouteToRouteTable:

关于amazon-web-services - 模板包含错误:模板格式错误:YAML 格式不正确。 (第 30 行,第 9 列)即 Type: AWS::EC2::Route 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74076710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com