EC2ManagedNAT

Table of Contents

Client

class EC2ManagedNAT.Client

A low-level client representing EC2 Managed NAT:

import boto3

client = boto3.client('managednat')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
create_nat_gateway(**kwargs)

Starts the creation of NAT Gateway in the specified subnet, the provided EIP will be attached. Once the NAT Gateway is in the AVAILABLE state it is ready to be used. This call is idempotent if called with a clientToken.

See also: AWS API Documentation

Request Syntax

response = client.create_nat_gateway(
    clientToken='string',
    subnetId='string',
    allocationId='string'
)
Parameters
  • clientToken (string) -- Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Constraints: Maximum 64 ASCII characters.
  • subnetId (string) -- [REQUIRED] A subnet in which the NAT Gateway will be created. NAT Gateway will place an Elastic Network Interface in this subnet and take one private IP address from the subnets IP range. If you want to use a NAT Gateway to access the Internet or other AWS services outside EC2, please launch it in a public subnet.
  • allocationId (string) -- [REQUIRED] The allocation ID of an Elastic IP Address which will be associated with the NAT Gateway.
Return type

dict

Returns

Response Syntax

{
    'clientToken': 'string',
    'NatGateway': {
        'VpcId': 'string',
        'SubnetId': 'string',
        'NatGatewayId': 'string',
        'createTime': datetime(2015, 1, 1),
        'deleteTime': datetime(2015, 1, 1),
        'NatGatewayAddresses': [
            {
                'PublicIp': 'string',
                'AllocationId': 'string',
                'PrivateIp': 'string',
                'NetworkInterfaceId': 'string'
            },
        ],
        'State': 'pending'|'failed'|'available'|'deleting'|'deleted',
        'failureCode': 'string',
        'failureMessage': 'string'
    }
}

Response Structure

  • (dict) --
    • clientToken (string) -- Unique, case-sensitive identifier you provide to ensure the idempotency of the request.
    • NatGateway (dict) -- Information about the NAT Gateway.
      • VpcId (string) --
      • SubnetId (string) --
      • NatGatewayId (string) --
      • createTime (datetime) --
      • deleteTime (datetime) --
      • NatGatewayAddresses (list) --
        • (dict) --
          • PublicIp (string) --
          • AllocationId (string) --
          • PrivateIp (string) --
          • NetworkInterfaceId (string) --
      • State (string) -- State the NAT Gateway is currently in.
        • 'pending' means the NAT Gateway is still being created and is not ready to serve traffic.
        • 'failed' means that the NAT Gateway could not be created. The failureCode/failureMessage will contain the reason.
        • 'available' means the NAT Gateway is able to serve traffic.
        • 'deleting' means the NAT Gateway may still be serving traffic, but is in the process of tearing down.
        • 'deleted' means all NAT Gateway resources have been cleaned up.
      • failureCode (string) --
      • failureMessage (string) -- Detailed reason for why the NAT Gateway is in the FAILED state.

delete_nat_gateway(**kwargs)

Deletes a specified NAT Gateway. Deleting the NAT Gateway doesn't delete the NAT Gateway routes in route tables. These routes will be blackholed before manually removed or updated. Deleting the NAT Gateway will disassociate the Elastic IP addresses. If you do not need these addresses any more, please release them to avoid additional cost for keeping these addresses idle.

See also: AWS API Documentation

Request Syntax

response = client.delete_nat_gateway(
    natGatewayId='string'
)
Parameters
natGatewayId (string) -- [REQUIRED] The NatGateway ID to delete.
Return type
dict
Returns
Response Syntax
{
    'NatGatewayId': 'string'
}

Response Structure

  • (dict) --
    • NatGatewayId (string) -- The deleted NatGateway ID.
describe_nat_gateway_supported_zones()

Return the list of zones that are supported by Managed Nat

See also: AWS API Documentation

Request Syntax

response = client.describe_nat_gateway_supported_zones()
Return type
dict
Returns
Response Syntax
{
    'supportedZones': [
        'string',
    ]
}

Response Structure

  • (dict) --
    • supportedZones (list) -- List of supported zones.
      • (string) --
describe_nat_gateways(**kwargs)

Describes one or more NAT Gateways. Call is create/read consistent but the state of the NAT Gateway is updated asynchronously.

See also: AWS API Documentation

Request Syntax

response = client.describe_nat_gateways(
    natGatewayId=[
        'string',
    ],
    filters=[
        {
            'name': 'string',
            'value': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string'
)
Parameters
  • natGatewayId (list) --

    One or more NAT Gateway IDs.

    • (string) --
  • filters (list) --
    • (dict) --
      • name (string) --
      • value (list) --
        • (string) --
  • maxResults (integer) -- The maximum number of items to return for this request. The request returns a token that you can specify in a subsequent call to get the next set of results. Constraint: Minimum value of 5 and if the value is greater than 1000, we return only 1000 items.
  • nextToken (string) -- The token for the next set of items to return. (You received this token from a prior DescribeNatGateways call)
Return type

dict

Returns

Response Syntax

{
    'nextToken': 'string',
    'NatGateways': [
        {
            'VpcId': 'string',
            'SubnetId': 'string',
            'NatGatewayId': 'string',
            'createTime': datetime(2015, 1, 1),
            'deleteTime': datetime(2015, 1, 1),
            'NatGatewayAddresses': [
                {
                    'PublicIp': 'string',
                    'AllocationId': 'string',
                    'PrivateIp': 'string',
                    'NetworkInterfaceId': 'string'
                },
            ],
            'State': 'pending'|'failed'|'available'|'deleting'|'deleted',
            'failureCode': 'string',
            'failureMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --
    • nextToken (string) -- The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.
    • NatGateways (list) -- Information about the endpoints.
      • (dict) --
        • VpcId (string) --
        • SubnetId (string) --
        • NatGatewayId (string) --
        • createTime (datetime) --
        • deleteTime (datetime) --
        • NatGatewayAddresses (list) --
          • (dict) --
            • PublicIp (string) --
            • AllocationId (string) --
            • PrivateIp (string) --
            • NetworkInterfaceId (string) --
        • State (string) -- State the NAT Gateway is currently in.
          • 'pending' means the NAT Gateway is still being created and is not ready to serve traffic.
          • 'failed' means that the NAT Gateway could not be created. The failureCode/failureMessage will contain the reason.
          • 'available' means the NAT Gateway is able to serve traffic.
          • 'deleting' means the NAT Gateway may still be serving traffic, but is in the process of tearing down.
          • 'deleted' means all NAT Gateway resources have been cleaned up.
        • failureCode (string) --
        • failureMessage (string) -- Detailed reason for why the NAT Gateway is in the FAILED state.

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_nat_gateway_count(**kwargs)

Get the count of NAT Gateways in the region (Not exposed via Xino). The returned count is eventually consistent.

See also: AWS API Documentation

Request Syntax

response = client.get_nat_gateway_count(
    accountId='string'
)
Parameters
accountId (string) -- [REQUIRED] The customer account Id.
Return type
dict
Returns
Response Syntax
{
    'natGatewayCount': 123
}

Response Structure

  • (dict) --
    • natGatewayCount (integer) -- Number of NAT Gateways for the supplied account. This count is eventually consistent.
get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)