Skip to content

create_customer_gateway async

create_customer_gateway(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    bgp_asn: Optional[Integer] = None,
    public_ip: Optional[String] = None,
    certificate_arn: Optional[String] = None,
    type: Optional[GatewayType] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    device_name: Optional[String] = None,
    ip_address: Optional[String] = None,
    bgp_asn_extended: Optional[Long] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateCustomerGatewayResult

Provides information to Amazon Web Services about your customer gateway device. The customer gateway device is the appliance at your end of the VPN connection. You must provide the IP address of the customer gateway device’s external interface. The IP address must be static and can be behind a device performing network address translation (NAT).

For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN. For more information, see Customer gateway options for your Site-to-Site VPN connection in the Amazon Web Services Site-to-Site VPN User Guide.

To create more than one customer gateway with the same VPN type, IP address, and BGP ASN, specify a unique device name for each customer gateway. An identical request returns information about the existing customer gateway; it doesn't create a new customer gateway.

Parameters:

  • bgp_asn (Optional[Integer], default: None ) –

    For customer gateway devices that support BGP, specify the device's ASN. You must specify either BgpAsn or BgpAsnExtended when creating the customer gateway. If the ASN is larger than 2,147,483,647, you must use BgpAsnExtended.

    Default: 65000

    Valid values: 1 to 2,147,483,647

  • public_ip (Optional[String], default: None ) –

    This member has been deprecated. The Internet-routable IP address for the customer gateway's outside interface. The address must be static.

  • certificate_arn (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) for the customer gateway certificate.

  • type (Optional[GatewayType], default: None ) –

    The type of VPN connection that this customer gateway supports (ipsec.1).

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to apply to the customer gateway.

  • device_name (Optional[String], default: None ) –

    A name for the customer gateway device.

    Length Constraints: Up to 255 characters.

  • ip_address (Optional[String], default: None ) –

    The IP address for the customer gateway device's outside interface. The address must be static. If OutsideIpAddressType in your VPN connection options is set to PrivateIpv4, you can use an RFC6598 or RFC1918 private IPv4 address. If OutsideIpAddressType is set to Ipv6, you can use an IPv6 address.

  • bgp_asn_extended (Optional[Long], default: None ) –

    For customer gateway devices that support BGP, specify the device's ASN. You must specify either BgpAsn or BgpAsnExtended when creating the customer gateway. If the ASN is larger than 2,147,483,647, you must use BgpAsnExtended.

    Valid values: 2,147,483,648 to 4,294,967,295

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Examples:

To create a customer gateway This example creates a customer gateway with the specified IP address for its outside interface.

>>> await client.create_customer_gateway(type='ipsec.1', public_ip='12.1.2.3', bgp_asn=65534)
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_customer_gateway(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    bgp_asn: Optional["capo_ec2.types.integer.Integer"] = None,
    public_ip: Optional["capo_ec2.types.string.String"] = None,
    certificate_arn: Optional["capo_ec2.types.string.String"] = None,
    type: Optional["capo_ec2.types.gateway_type.GatewayType"] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
    device_name: Optional["capo_ec2.types.string.String"] = None,
    ip_address: Optional["capo_ec2.types.string.String"] = None,
    bgp_asn_extended: Optional["capo_ec2.types.long.Long"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.create_customer_gateway_result.CreateCustomerGatewayResult":
    """<p>Provides information to Amazon Web Services about your customer gateway device. The customer gateway device is the appliance at your end of the VPN connection. You must provide the IP address of the customer gateway device’s external interface. The IP address must be static and can be behind a device performing network address translation (NAT).</p> <p>For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN. For more information, see <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/cgw-options.html">Customer gateway options for your Site-to-Site VPN connection</a> in the <i>Amazon Web Services Site-to-Site VPN User Guide</i>.</p> <p>To create more than one customer gateway with the same VPN type, IP address, and BGP ASN, specify a unique device name for each customer gateway. An identical request returns information about the existing customer gateway; it doesn't create a new customer gateway.</p>

    Args:
        bgp_asn: <p>For customer gateway devices that support BGP, specify the device's ASN. You must specify either <code>BgpAsn</code> or <code>BgpAsnExtended</code> when creating the customer gateway. If the ASN is larger than <code>2,147,483,647</code>, you must use <code>BgpAsnExtended</code>.</p> <p>Default: 65000</p> <p>Valid values: <code>1</code> to <code>2,147,483,647</code> </p>
        public_ip: <p> <i>This member has been deprecated.</i> The Internet-routable IP address for the customer gateway's outside interface. The address must be static.</p>
        certificate_arn: <p>The Amazon Resource Name (ARN) for the customer gateway certificate.</p>
        type: <p>The type of VPN connection that this customer gateway supports (<code>ipsec.1</code>).</p>
        tag_specifications: <p>The tags to apply to the customer gateway.</p>
        device_name: <p>A name for the customer gateway device.</p> <p>Length Constraints: Up to 255 characters.</p>
        ip_address: <p>The IP address for the customer gateway device's outside interface. The address must be static. If <code>OutsideIpAddressType</code> in your VPN connection options is set to <code>PrivateIpv4</code>, you can use an RFC6598 or RFC1918 private IPv4 address. If <code>OutsideIpAddressType</code> is set to <code>Ipv6</code>, you can use an IPv6 address. </p>
        bgp_asn_extended: <p>For customer gateway devices that support BGP, specify the device's ASN. You must specify either <code>BgpAsn</code> or <code>BgpAsnExtended</code> when creating the customer gateway. If the ASN is larger than <code>2,147,483,647</code>, you must use <code>BgpAsnExtended</code>.</p> <p>Valid values: <code>2,147,483,648</code> to <code>4,294,967,295</code> </p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a customer gateway
        This example creates a customer gateway with the specified IP address for its outside interface.

        >>> await client.create_customer_gateway(type='ipsec.1', public_ip='12.1.2.3', bgp_asn=65534)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_customer_gateway_request.CreateCustomerGatewayRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_customer_gateway_result.CreateCustomerGatewayResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_customer_gateway

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.create_customer_gateway.async_create_customer_gateway(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCustomerGateway")
    )
    input_: capo_ec2.types.create_customer_gateway_request.CreateCustomerGatewayRequest = {}
    if bgp_asn is not None:
        input_["bgp_asn"] = bgp_asn
    if public_ip is not None:
        input_["public_ip"] = public_ip
    if certificate_arn is not None:
        input_["certificate_arn"] = certificate_arn
    if type is not None:
        input_["type"] = type
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if device_name is not None:
        input_["device_name"] = device_name
    if ip_address is not None:
        input_["ip_address"] = ip_address
    if bgp_asn_extended is not None:
        input_["bgp_asn_extended"] = bgp_asn_extended
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output