Skip to content

create_internet_gateway async

create_internet_gateway(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateInternetGatewayResult

Creates an internet gateway for use with a VPC. After creating the internet gateway, you attach it to a VPC using AttachInternetGateway.

For more information, see Internet gateways in the Amazon VPC User Guide.

Parameters:

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

    The tags to assign to the internet gateway.

  • 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 an Internet gateway This example creates an Internet gateway.

>>> await client.create_internet_gateway()
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_internet_gateway(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.create_internet_gateway_result.CreateInternetGatewayResult":
    """<p>Creates an internet gateway for use with a VPC. After creating the internet gateway, you attach it to a VPC using <a>AttachInternetGateway</a>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html">Internet gateways</a> in the <i>Amazon VPC User Guide</i>.</p>

    Args:
        tag_specifications: <p>The tags to assign to the internet gateway.</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 an Internet gateway
        This example creates an Internet gateway.

        >>> await client.create_internet_gateway()
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_internet_gateway_request.CreateInternetGatewayRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_internet_gateway_result.CreateInternetGatewayResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_internet_gateway

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInternetGateway")
    )
    input_: capo_ec2.types.create_internet_gateway_request.CreateInternetGatewayRequest = {}
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    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