VPC gateway attachment limit exceeded

Follow the attachment limits for each gateway type.

Description

VPC gateway limits depend on the gateway type. A VPC can have one internet gateway and one virtual private gateway attached at a time; there is no universal three-gateway limit.

Potential impact

Unsupported duplicate attachments fail and can prevent deployment of the required network configuration.

Remediation

Check the limits and required connections for each gateway type, and remove duplicate attachments. Assess routing and VPN impacts before replacing an existing attachment.

Examples

These excerpts replace an attempt to attach several virtual private gateways to the same myVPC with one attachment. Define the VPC and gateway separately.

Before

yaml
Resources:
  AttachVpnGateway:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: myVPC
      VpnGatewayId:
        Ref: myVPNGateway

  AttachVpnGateway2:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: myVPC
      VpnGatewayId:
        Ref: myVPNGateway2

  AttachVpnGateway3:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: myVPC
      VpnGatewayId:
        Ref: myVPNGateway3

  AttachVpnGateway4:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: myVPC
      VpnGatewayId:
        Ref: myVPNGateway4

After

yaml
Resources:
  AttachVpnGateway:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: myVPC
      VpnGatewayId:
        Ref: myVPNGateway

References