2017-10-29 22 views
-2

私はVPCを作成するために雲の形成を使用しています。また、サブネットを作成すると失敗します。私は確認し、私はサブネットが有効であると信じています。私のネットワーキングの知識はいくぶん欠けています。無効なサブネットのためにAWSでVPCを作成できません

これは私が取得エラーです:

00:46:49 UTC-0400 CREATE_FAILED AWS::EC2::Subnet SubnetA The CIDR '172.16.64.0/16' is invalid. 

午後12時46分49秒は、UTC-0400 CREATE_IN_PROGRESS AWS :: EC2 ::のRouteTableのRouteTableリソースの作成が 午後12時46分49秒UTC-0400 CREATE_FAILED AWSを開始しました。 :EC2 :: Subnet SubnetB CIDR '197.16.128.0/16'は無効です。

そして、これは私が使用しようとしているテンプレートです:

--- 
AWSTemplateFormatVersion: 2010-09-09 
Resources: 
    VPC: 
    Type: AWS::EC2::VPC 
    Properties: 
     CidrBlock: 172.16.0.0/18 
     EnableDnsSupport: true 
     EnableDnsHostnames: true 
     InstanceTenancy: default 
     Tags: 
     - Key: Name 
     Value: JF-Staging-VPC 
    InternetGateway: 
    Type: AWS::EC2::InternetGateway 
    VPCGatewayAttachment: 
    Type: AWS::EC2::VPCGatewayAttachment 
    Properties: 
     VpcId: !Ref VPC 
     InternetGatewayId: !Ref InternetGateway 
    SubnetA: 
    Type: AWS::EC2::Subnet 
    Properties: 
     AvailabilityZone: us-east-1a 
     VpcId: !Ref VPC 
     CidrBlock: 172.16.64.0/16 
     MapPublicIpOnLaunch: False 
    SubnetB: 
     Type: AWS::EC2::Subnet 
     Properties: 
     AvailabilityZone: us-east-1b 
     VpcId: !Ref VPC 
     CidrBlock: 197.16.128.0/16 
     MapPublicIpOnLaunch: False 
    RouteTable: 
    Type: AWS::EC2::RouteTable 
    Properties: 
     VpcId: !Ref VPC 
    InternetRoute: 
    Type: AWS::EC2::Route 
    DependsOn: InternetGateway 
    Properties: 
     DestinationCidrBlock: 0.0.0.0/0 
     GatewayId: !Ref InternetGateway 
     RouteTableId: !Ref RouteTable 
    SubnetARouteTableAssociation: 
    Type: AWS::EC2::SubnetRouteTableAssociation 
    Properties: 
     RouteTableId: !Ref RouteTable 
     SubnetId: !Ref SubnetA 
    SubnetBRouteTableAssociation: 
    Type: AWS::EC2::SubnetRouteTableAssociation 
    Properties: 
     RouteTableId: !Ref RouteTable 
     SubnetId: !Ref SubnetB 
    SecurityGroupSSH: 
    Type: AWS::EC2::SecurityGroup 
    Properties: 
     GroupName: "SSH Group" 
     GroupDescription: "SSH traffic in, all traffic out." 
     VpcId: !Ref VPC 
     SecurityGroupIngress: 
     - IpProtocol: tcp 
      FromPort: '22' 
      ToPort: '22' 
      CidrIp: 0.0.0.0/0 
     SecurityGroupEgress: 
     - IpProtocol: -1 
      CidrIp: 0.0.0.0/0 
    SecurityGroupWeb: 
    Type: AWS::EC2::SecurityGroup 
    Properties: 
     GroupName: "Web Group" 
     GroupDescription: "Web traffic in, all traffic out." 
     VpcId: !Ref VPC 
     SecurityGroupIngress: 
     - IpProtocol: tcp 
      FromPort: '80' 
      ToPort: '80' 
      CidrIp: 0.0.0.0/0 
     SecurityGroupEgress: 
     - IpProtocol: -1 
      CidrIp: 0.0.0.0/0 
     SecurityGroupIngress: 
     - IpProtocol: tcp 
      FromPort: '443' 
      ToPort: '443' 
      CidrIp: 0.0.0.0/0 
     SecurityGroupEgress: 
     - IpProtocol: -1 
      CidrIp: 0.0.0.0/0 
Metadata: 
    VPC: 
    Description: "Creating the JF Staging VPC" 
    InternetGateway: 
    Description: "Creating an Internet Gateway" 

誰かが私が間違っているとどのようにこれを修正するよどこに私が知っていることはできますか?

+0

ないプログラミングの質問 - [SU]をしてみてください? –

答えて

1

問題は、VPCまたはサブネットに割り当てることができないパブリックIPアドレスである197.16.128.0/16にあります。 172.16.0.0/16 へのあなたのVPCは、その後に各サブネットを変更

172.16.128.0/16

[EDIT]

変更:

私はあなたが本当にアドレスを使用するためのものだと思います/ 16の一部を使用します。/24 例:

172.16.0.0/24

172.16.1.0/24

172.16.2.0/24

など

問題あなたの現在の実装であることですあなたのVPCは/ 18で、作成しようとしているサブネット/ 16より小さい。 VPCの場合は/ 16、サブネットの場合は/ 24より小さいか、/ 16より小さいものを使用します。

+0

よろしくお願いいたします。 \t「CIDR」172.16.128.0/16が別のサブネットと競合しています テンプレート内のその他すべてが同じ – bluethundr

+0

@bluethundrのままです。私はあなたのテンプレートを読み直した後、私の答えを更新しました。また、John Rotensteinの答えをレビューしてください。 –

+0

ありがとう、ありがとう!します。 – bluethundr

関連する問題