在Aws CloudFormation中创建堆践时,出现以下错误
可是检查ymal文件时,发现第61行的21列的地方并没有明显错误(网上所说的大小写或空格之类的)
想请教一下错误在何处并如何改正。谢谢!!
具体代码如下:
AWSTemplateFormatVersion: "2010-09-09"
Description: >
sp vpc init stack.
Parameters:
ServiceName:
Type: String
EnvironmentType:
Type: String
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "basic configurations."
Parameters:
- ServiceName
- EnvironmentType
Mappings:
RegionParamsMap:
ap-south-1:
Number: 201
ap-northeast-1:
Number: 202
Resources:
SpVpcInitStackCreateVpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Sub
- 10.${Number}.0.0/16
- { Number: !FindInMap ["RegionParamsMap", !Ref AWS::Region, Number] }
EnableDnsHostnames: true
EnableDnsSupport: true
InstanceTenancy: default
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc
VpcNetworkSpStackCreateInternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-internet-gateway
VpcNetworkSpStackCreateInternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref SpVpcInitStackCreateVpc
InternetGatewayId:
!Ref VpcNetworkSpStackCreateInternetGateway
VpcNetworkSpStackCreatePublicSubneta1a:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !Sub
- 10.${Number}.120.0/20
- { Number: !FindInMap ["RegionParamsMap", !Ref AWS::Region, Number] }
VpcId: !Ref SpVpcInitStackCreateVpc
AvailabilityZone: !Select
0
- Fn::GetAZs: !Ref AWS::Region
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-public-subnet-a1a
VpcNetworkSpStackCreateSpVpcNatGateway1aEip:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-nat-gw-1a-eip
VpcNetworkSpStackCreateSpVpcNatGateway1a:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
!GetAtt VpcNetworkSpStackCreateSpVpcNatGateway1aEip.AllocationId
SubnetId:
!Ref VpcNetworkSpStackCreatePublicSubneta1a
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-nat-gw-1a
VpcNetworkSpStackCreateSpVpcPublicSubneta1aRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref SpVpcInitStackCreateVpc
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-public-subnet-a1a-route-table
VpcNetworkSpStackCreateSpVpcPublica1aSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPublicSubneta1aRouteTable
SubnetId:
!Ref VpcNetworkSpStackCreatePublicSubneta1a
VpcNetworkSpStackCreateSpVpcPublicSubneta1aRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPublicSubneta1aRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
!Ref VpcNetworkSpStackCreateInternetGateway
VpcNetworkSpStackCreatePrivateSubnetb1a:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !Sub
- 10.${Number}.0.0/19
- { Number: !FindInMap ["RegionParamsMap", !Ref AWS::Region, Number] }
VpcId: !Ref SpVpcInitStackCreateVpc
AvailabilityZone: !Select
0
- Fn::GetAZs: !Ref AWS::Region
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-private-subnet-b1a
VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref SpVpcInitStackCreateVpc
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-private-subnet-b1a-route-table
VpcNetworkSpStackCreateSpVpcPrivateb1aSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRouteTable
SubnetId:
!Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRouteTable
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
!Ref VpcNetworkSpStackCreateSpVpcNatGateway1a
VpcNetworkSpStackCreatePrivateSubnetc1a:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: !Sub
- 10.${Number}.192.0/21
- { Number: !FindInMap ["RegionParamsMap", !Ref AWS::Region, Number] }
VpcId: !Ref SpVpcInitStackCreateVpc
AvailabilityZone: !Select
0
- Fn::GetAZs: !Ref AWS::Region
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-private-subnet-c1a
VpcNetworkSpStackCreateSpVpcPrivateSubnetc1aRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref SpVpcInitStackCreateVpc
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-private-subnet-c1a-route-table
VpcNetworkSpStackCreateSpVpcPrivatec1aSubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetc1aRouteTable
SubnetId:
!Ref VpcNetworkSpStackCreatePrivateSubnetc1a
VpcNetworkSpStackCreateSpVpcPrivateSubnetc1aRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId:
!Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetc1aRouteTable
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
!Ref VpcNetworkSpStackCreateSpVpcNatGateway1a
VpcNetworkSpStackCreateVpcEndpointApigwSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: sp vpc vpc endpoint api gateway security group.
GroupName: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-apigw-security-group
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: egress all traffic.
IpProtocol: -1
SecurityGroupIngress: []
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-apigw-security-group
VpcId: !Ref SpVpcInitStackCreateVpc
VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: sp vpc vpc endpoint ecs security group.
GroupName: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-ecs-security-group
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: egress all traffic.
IpProtocol: -1
SecurityGroupIngress: []
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-ecs-security-group
VpcId: !Ref SpVpcInitStackCreateVpc
VpcNetworkSpStackCreateVpcEndpointDbSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: sp vpc vpc endpoint database security group.
GroupName: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-db-security-group
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: egress all traffic.
IpProtocol: -1
SecurityGroupIngress: []
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-db-security-group
VpcId: !Ref SpVpcInitStackCreateVpc
VpcNetworkSpStackCreateVpcEndpointAwsIotSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: sp vpc vpc endpoint aws iot security group.
GroupName: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-awsiot-security-group
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: egress all traffic.
IpProtocol: -1
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
Description: inegress all traffic.
IpProtocol: -1
Tags:
- Key: Name
Value: !Sub ${EnvironmentType}-sp-vpc-vpc-endpoint-awsiot-security-group
VpcId: !Ref SpVpcInitStackCreateVpc
VpcNetworkSpStackCreateVpcEndpointEcrDkr:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.ecr.dkr
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: true
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateVpcEndpointEcrApi:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.ecr.api
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: true
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateVpcEndpointStepfunctions:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.states
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: true
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateVpcEndpointApigateway:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.execute-api
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: true
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateLayerBVpcEndpointLogs:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.logs
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: false
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateLayerCVpcEndpointLogs:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.logs
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: false
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointDbSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetc1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateLayerBVpcEndpointAwsIot:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.iot.data
VpcId: !Ref SpVpcInitStackCreateVpc
PrivateDnsEnabled: false
SecurityGroupIds:
- !Ref VpcNetworkSpStackCreateVpcEndpointAwsIotSecurityGroup
SubnetIds:
- !Ref VpcNetworkSpStackCreatePrivateSubnetb1a
VpcEndpointType: Interface
VpcNetworkSpStackCreateVpcEndpointS3:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.s3
VpcId: !Ref SpVpcInitStackCreateVpc
RouteTableIds:
- !Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRouteTable
- !Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetc1aRouteTable
VpcEndpointType: Gateway
VpcNetworkSpStackCreateVpcEndpointDynamodb:
Type: AWS::EC2::VPCEndpoint
Properties:
ServiceName: !Sub com.amazonaws.${AWS::Region}.dynamodb
VpcId: !Ref SpVpcInitStackCreateVpc
RouteTableIds:
- !Ref VpcNetworkSpStackCreateSpVpcPrivateSubnetb1aRouteTable
VpcEndpointType: Gateway
Outputs:
SpVpcId:
Description: sp vpc id.
Value: !Ref SpVpcInitStackCreateVpc
Export:
Name: SpVpcId
SpVpcEndpointEcsSecurityGroupId:
Description: "sp vpc ecs endpoint security group id."
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup.GroupId
SpVpcEndpointDbSecurityGroupGroupId:
Description: "sp vpc database endpoint security group id."
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointDbSecurityGroup.GroupId
SpApigwVpcEndpointId:
Description: "apigw vpc endpoint id."
Value:
!Ref VpcNetworkSpStackCreateVpcEndpointApigateway
SpVpcSubnetA1aId:
Description: "sp vpc database security group id."
Value:
!Ref VpcNetworkSpStackCreatePublicSubneta1a
SpVpcSubnetB1aId:
Description: "sp vpc database security group id."
Value:
!Ref VpcNetworkSpStackCreatePrivateSubnetb1a
SpVpcSubnetC1aId:
Description: "sp vpc database security group id."
Value:
!Ref VpcNetworkSpStackCreatePrivateSubnetc1a
SpVpcEndpointApigatewayId:
Description: "vpc endpoint apigateway id."
Value:
!Ref VpcNetworkSpStackCreateVpcEndpointApigateway
SpVpcVpcEndpointEcsSecurityGroupId:
Description: "sp vpc vpc endpoint ecs security group id."
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup.GroupId
SpVpcVpcEndpointDbSecurityGroupId:
Description: "sp vpc vpc endpoint db security group id."
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointDbSecurityGroup.GroupId
SpVpcPrivateAppSubnetIds:
Description: "sp vpc private app subnet ids use cdk."
Value:
!Sub ${VpcNetworkSpStackCreatePrivateSubnetb1a} #,${VpcNetworkSpStackCreatePrivateSubnetb1b},${VpcNetworkSpStackCreatePrivateSubnetb1c}
Export:
Name: SpVpcPrivateAppSubnetIds
VpcEndpointDbSecurityGroupId:
Description: "sp vpc database endpoint security group id. use cdk"
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointDbSecurityGroup.GroupId
Export:
Name: VpcEndpointDbSecurityGroupId
SpVpcPrivateDataSubnetIds:
Description: "sp vpc private data subnet ids use cdk."
Value:
!Sub ${VpcNetworkSpStackCreatePrivateSubnetc1a} #,${VpcNetworkSpStackCreatePrivateSubnetc1b},${VpcNetworkSpStackCreatePrivateSubnetc1c}
Export:
Name: SpVpcPrivateDataSubnetIds
VpcEndpointEcsSecurityGroupId:
Description: "sp vpc vpc endpoint ecs security group id use cdk."
Value:
!GetAtt VpcNetworkSpStackCreateVpcEndpointEcsSecurityGroup.GroupId
Export:
Name: VpcEndpointEcsSecurityGroupId