gpt4 book ai didi

amazon-web-services - 由于错误而无法呈现模板。 : YAMLException

转载 作者:行者123 更新时间:2023-12-03 07:39:47 24 4
gpt4 key购买 nike

我正在尝试部署 aws cloudformation 堆栈,但它给出了此错误“由于错误而无法渲染模板。: YAMLException: 第 63 行第 5 列重复的映射键:DataCenterPublicSubnet: ^”我该如何解决这个问题?

AWSTemplateFormatVersion: 2010-09-09
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: Extract Predict Part 1 - File Server resource deployment
Parameters:
- VPC
- Subnet
- KeyName
- SecurityGroupIds
- LatestLinuxAmiId
Parameters:
EnvironmentName: DE-Extract
Description: An environment name that is prefixed to resource names
Type: String
VpcCIDR:
Description: Please enter the IP range (CIDR notation) for this VPC
Type: String
Default: 192.168.0.0/16

DataCenterPublicSubnetCIDR:
Description: Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone
Type: String
Default: 192.168.10.0/24

VPC:
Description: VPC to deploy resources into.
Type: 'AWS::EC2::VPC::Id'
Properties:
CidrBlock: !Ref VpcCIDR
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Ref EnvironmentName
Subnet:
Description: Subnet to deploy resources into.
Type: 'AWS::EC2::Subnet::Id'
SecurityGroupIds:
Description: Specify the security group/s for resources.
Type: 'List<AWS::EC2::SecurityGroup::Id>'
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the file server.
Type: 'AWS::EC2::KeyPair::KeyName'
ConstraintDescription: Must be the name of an existing EC2 KeyPair.
LatestLinuxAmiId:
Description: Do Not modify the below default value!
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
Resources:
InternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: !Ref EnvironmentName
InternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
DataCenterPublicSubnet:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs '' ]
CidrBlock: !Ref DataCenterPublicSubnetCIDR
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub DE-Extract Data Center Subnet
PrivateRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: !Sub DE-Extract Public Routes
DefaultPrivateRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PrivateRouteTable
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId: !Ref NatGateway
DataCenterPublicSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PrivateRouteTable
SubnetId: !Ref PrivateSubnet
LinuxInstance:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: !Ref LatestLinuxAmiId
KeyName: !Ref KeyName
InstanceType: t2.micro
IamInstanceProfile: !Ref s3ROInstanceProfile
SecurityGroupIds: !Ref SecurityGroupIds
SubnetId: !Ref Subnet
Tags:
- Key: Name
Value: DE-Extract-Linux-Instance
UserData: !Base64
'Fn::Join':
- ''
- - |
#!/bin/bash
- |
yum install -y aws-cfn-bootstrap
- |
sudo su
- |
mkdir /temp
- |
aws s3 sync s3://de-extract-predict-payload/Pre_Script /temp
- |
chmod 755 /temp/prescript.sh
- |
cd /temp
- |
./prescript.sh
- |
rm prescript.sh
s3ROInstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Path: /
Roles:
- !Ref s3ROrole
s3ROAccessPolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: s3ROAccessPolicy
PolicyDocument:
Statement:
- Effect: Allow
Action:
- 's3:Get*'
- 's3:List*'
Resource: '*'
Roles:
- !Ref s3ROrole
s3ROrole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
Outputs:
LinuxInstance:
Description: Private IP address of the newly created File server EC2 instance
Value: !GetAtt
- LinuxInstance
- PrivateIp

最佳答案

模板中的所有缩进都不正确。在尝试从模板创建堆栈之前,您必须确保模板的用途正确。

关于amazon-web-services - 由于错误而无法呈现模板。 : YAMLException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72382204/

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