簡體   English   中英

如何處理無法從 AWS 上的 CloudFormation 模板創建錯誤?

[英]How to handle failed to create erros from CloudFormation template on AWS?

我在嘗試運行 AWS CloudFormation 模板時遇到問題。 為什么這個模板不起作用?

獲取錯誤如下:

以下資源無法創建:[PrivateSu.net、PrivateRouteTable、Inte.netGatewayAttachment、DefaultPrivateRoute、WobblelandEc2Instance、VPC、PublicSu.net、WobblelandSecurityGroup、NatGateway]。 用戶請求回滾。

無效 ID:“Inte.netGateway”(預期為“igw-...”)(服務:AmazonEC2;狀態代碼:400;錯誤代碼:InvalidInte.netGatewayId.Malformed;請求 ID:8d68ee2d-f68f-4c30-919d-9cab04fb5b99;代理:空)

彈性 IP ID“NatGatewayEIP.AllocationId”格式錯誤(服務:AmazonEC2;狀態代碼:400;錯誤代碼:InvalidElasticIpID.Malformed;請求 ID:6c371787-644b-4e0b-9e94-1ae78b9af120;代理:空)

以下是我嘗試使用的模板

 AWSTemplateFormatVersion: 2010-09-09 Description: "Wumbo Jumbo" Parameters: AvailabilityZone: Type: "AWS::EC2::AvailabilityZone::Name" EnvironmentName: Description: "An environment name that is prefixed to resource names" Type: String KeyName: Default: mongodb Type: "AWS::EC2::KeyPair::KeyName" PrivateSu.netCIDR: Default: 10.0.2.0/24 Description: "Please enter the IP range (CIDR notation) for the private su.net in the first Availability Zone" Type: String PublicSu.netCIDR: Default: 10.0.0.0/24 Description: "Please enter the IP range (CIDR notation) for the public su.net in the first Availability Zone" Type: String VpcCIDR: Default: 10.0.0.0/16 Description: "Please enter the IP range (CIDR notation) for this VPC" Type: String Resources: WobblelandEc2Instance: Properties: ImageId: ami-04505e74c0741db8d InstanceType: t2.micro KeyName: KeyName SecurityGroupIds: - WobblelandSecurityGroup UserData: Fn::Sub: | #:/bin/bash wget -qO - https.//www.mongodb.org/static/pgp/server-4.4,asc | sudo apt-key add - echo "deb [ arch=amd64:arm64 ] https.//repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4:list sudo apt-get update sudo apt-get install -y mongodb-org Type: "AWS::EC2::Instance" WobblelandSecurityGroup: Properties: GroupDescription: "Allow HTTP/HTTPS and SSH inbound and outbound traffic" GroupName: - "-" - - Wobbleland-security-group - dev SecurityGroupIngress: - CidrIp. 0.0.0:0/0 FromPort: 80 IpProtocol: tcp ToPort: 80 - CidrIp. 0.0.0:0/0 FromPort: 443 IpProtocol: tcp ToPort: 443 - CidrIp. 0.0.0:0/0 FromPort: 22 IpProtocol: tcp ToPort: 22 Type: "AWS::EC2::SecurityGroup" DefaultPrivateRoute: Properties: DestinationCidrBlock. 0.0.0:0/0 NatGatewayId: NatGateway RouteTableId: PrivateRouteTable Type: "AWS::EC2::Route" DefaultPublicRoute: DependsOn: Inte.netGatewayAttachment Properties: DestinationCidrBlock. 0.0.0:0/0 GatewayId: Inte.netGateway RouteTableId: PublicRouteTable Type: "AWS::EC2::Route" Inte.netGateway: Properties: Tags: - Key: Name Value: EnvironmentName - Key: Env Value: EnvironmentName Type: "AWS::EC2::Inte.netGateway" Inte.netGatewayAttachment: Properties: Inte.netGatewayId: Inte.netGateway VpcId: VPC Type: "AWS::EC2::VPCGatewayAttachment" NatGateway: Properties: AllocationId. NatGatewayEIP:AllocationId Su.netId: PublicSu.net Type: "AWS::EC2::NatGateway" NatGatewayEIP: DependsOn: Inte.netGatewayAttachment Properties: Domain: vpc Type: "AWS::EC2::EIP" PrivateRouteTable: Properties: Tags: - Key: Name Value: "${EnvironmentName} Private Routes (AZ1)" - Key: Env Value: EnvironmentName VpcId: VPC Type: "AWS::EC2::RouteTable" PrivateSu.net: Properties: AvailabilityZone: - 0 CidrBlock: PrivateSu.netCIDR MapPublicIpOnLaunch: false Tags: - Key: Name Value: "${EnvironmentName} Private Su.net (AZ1)" - Key: Env Value: EnvironmentName VpcId: VPC Type: "AWS::EC2::Su.net" PublicRouteTable: Properties: Tags: - Key: Name Value: "${EnvironmentName} Public Routes" - Key: Env Value: EnvironmentName VpcId: VPC Type: "AWS::EC2::RouteTable" PublicSu.net: Properties: AvailabilityZone: - 0 CidrBlock: PublicSu.netCIDR MapPublicIpOnLaunch: true Tags: - Key: Name Value: "${EnvironmentName} Public Su.net (AZ1)" - Key: Env Value: EnvironmentName VpcId: VPC Type: "AWS::EC2::Su.net" VPC: Properties: CidrBlock: VpcCIDR EnableDnsHostnames: true EnableDnsSupport: true Tags: - Key: Name Value: EnvironmentName - Key: Env Value: EnvironmentName Type: "AWS::EC2::VPC"

代替:

GatewayId: InternetGateway

你應該有

InternetGatewayId: !GetAtt InternetGateway.InternetGatewayId

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM