EC2 / Client / detach_internet_gateway

detach_internet_gateway#

EC2.Client.detach_internet_gateway(**kwargs)#

Detaches an internet gateway from a VPC, disabling connectivity between the internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses or public IPv4 addresses.

See also: AWS API Documentation

Request Syntax

response = client.detach_internet_gateway(
    DryRun=True|False,
    InternetGatewayId='string',
    VpcId='string'
)
Parameters:
  • DryRun (boolean) – 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.

  • InternetGatewayId (string) –

    [REQUIRED]

    The ID of the internet gateway.

  • VpcId (string) –

    [REQUIRED]

    The ID of the VPC.

Returns:

None

Examples

This example detaches the specified Internet gateway from the specified VPC.

response = client.detach_internet_gateway(
    InternetGatewayId='igw-c0a643a9',
    VpcId='vpc-a01106c2',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}