Skip to content

create_vpn_gateway async

create_vpn_gateway(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    availability_zone: Optional[String] = None,
    type: Optional[GatewayType] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    amazon_side_asn: Optional[Long] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateVpnGatewayResult

Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.

For more information, see Amazon Web Services Site-to-Site VPN in the Amazon Web Services Site-to-Site VPN User Guide.

Parameters:

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

    The Availability Zone for the virtual private gateway.

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

    The type of VPN connection this virtual private gateway supports.

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

    The tags to apply to the virtual private gateway.

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

    A private Autonomous System Number (ASN) for the Amazon side of a BGP session. If you're using a 16-bit ASN, it must be in the 64512 to 65534 range. If you're using a 32-bit ASN, it must be in the 4200000000 to 4294967294 range.

    Default: 64512

  • 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:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_vpn_gateway(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    availability_zone: 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,
    amazon_side_asn: Optional["capo_ec2.types.long.Long"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.create_vpn_gateway_result.CreateVpnGatewayResult":
    """<p>Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html">Amazon Web Services Site-to-Site VPN</a> in the <i>Amazon Web Services Site-to-Site VPN User Guide</i>.</p>

    Args:
        availability_zone: <p>The Availability Zone for the virtual private gateway.</p>
        type: <p>The type of VPN connection this virtual private gateway supports.</p>
        tag_specifications: <p>The tags to apply to the virtual private gateway.</p>
        amazon_side_asn: <p>A private Autonomous System Number (ASN) for the Amazon side of a BGP session. If you're using a 16-bit ASN, it must be in the 64512 to 65534 range. If you're using a 32-bit ASN, it must be in the 4200000000 to 4294967294 range.</p> <p>Default: 64512</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_vpn_gateway_request.CreateVpnGatewayRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_vpn_gateway_result.CreateVpnGatewayResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_vpn_gateway

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateVpnGateway")
    )
    input_: capo_ec2.types.create_vpn_gateway_request.CreateVpnGatewayRequest = {}
    if availability_zone is not None:
        input_["availability_zone"] = availability_zone
    if type is not None:
        input_["type"] = type
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if amazon_side_asn is not None:
        input_["amazon_side_asn"] = amazon_side_asn
    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