nat_gateway#

State module for managing EC2 Nat Gateways.

hub.exec.boto3.client.ec2.create_nat_gateway hub.exec.boto3.client.ec2.delete_nat_gateway hub.exec.boto3.client.ec2.describe_nat_gateways

async idem_aws.states.aws.ec2.nat_gateway.present(hub, ctx, name: str, subnet_id: str, resource_id: str = None, connectivity_type: str = 'public', client_token: str = None, allocation_id: str = None, tags: Dict[str, Any] = None, timeout: Timeout = None) Dict[str, Any][source]#

Creates a NAT gateway in the specified subnet.

This action creates a network interface in the specified subnet with a private IP address from the IP address range of the subnet. You can create either a public NAT gateway or a private NAT gateway. With a public NAT gateway, internet-bound traffic from a private subnet can be routed to the NAT gateway, so that instances in a private subnet can connect to the internet. With a private NAT gateway, private communication is routed across VPCs and on-premises networks through a transit gateway or virtual private gateway. Common use cases include running large workloads behind a small pool of allowlisted IPv4 addresses, preserving private IPv4 addresses, and communicating between overlapping networks. For more information, see NAT gateways in the Amazon Virtual Private Cloud User Guide.

Parameters:
  • name (str) – An Idem name to identify the NAT gateway resource.

  • subnet_id (str) – The subnet in which to create the NAT gateway.

  • resource_id (str, Optional) – AWS Internet Gateway ID.

  • client_token (str, Optional) – Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Constraint: Maximum 64 ASCII characters. This field is autopopulated if not provided.

  • connectivity_type (str, Optional) – Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.

  • allocation_id (str, Optional) – [Public NAT gateway only]. The allocation ID of the Elastic IP address that’s associated with the NAT gateway.

  • tags (dict or list, Optional) –

    Dict in the format of {tag-key: tag-value} or List of tags in the format of [{"Key": tag-key, "Value": tag-value}] to associate with the NAT gateway resource. Defaults to None.

    • (Key, Optional):

      The key of the tag. Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

    • (Value, Optional):

      The value of the tag. Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

  • timeout (dict, Optional) –

    Timeout configuration for create/update/deletion of AWS IAM Policy.

    • create (dict):

      Timeout configuration for creating AWS IAM Policy * delay (int, Optional): The amount of time in seconds to wait between attempts. * max_attempts (int, Optional): Customized timeout configuration containing delay and max attempts.

    • update(dict, Optional):

      Timeout configuration for updating AWS IAM Policy

      • delay (int, Optional):

        The amount of time in seconds to wait between attempts.

      • max_attempts (int, Optional):

        Customized timeout configuration containing delay and max attempts.

Request Syntax:
[nat_gateway-name]:
  aws.ec2.nat_gateway.present:
    - subnet_id: 'string'
    - resource_id: 'string'
    - client_token: 'string'
    - connectivity_type: 'string'
    - allocation_id: 'string'
    - tags:
      - Key: 'string'
        Value: 'string'
    - timeout:
      create:
        delay: 'integer'
        max_attempts: 'integer'
      update:
        delay: 'integer'
        max_attempts: 'integer'
Returns:

Dict[str, Any]

Examples

my-nat-gateway:
  aws.ec2.nat_gateway.present:
    - subnet_id: subnet-026542dd856a97e15
    - client_token: nat-0e7969ddf4c38831f
    - resource_id: nat-0e7969ddf4c38831f
    - connectivity_type: private
    - tags:
      - Key: Name
        Value: test-nat-gateway
async idem_aws.states.aws.ec2.nat_gateway.absent(hub, ctx, name: str, resource_id: str = None, timeout: Dict = None) Dict[str, Any][source]#

Deletes the specified NAT gateway. Deleting a public NAT gateway disassociates its Elastic IP address, but does not release the address from your account. Deleting a NAT gateway does not delete any NAT gateway routes in your route tables.

Parameters:
  • name (str) – An Idem name to identify the NAT gateway resource.

  • resource_id (str, Optional) – The AWS ID of the nat gateway. Idem automatically considers this resource being absent if this field is not specified.

  • timeout (dict, Optional) –

    Timeout configuration for deletion of AWS Nat Gateway. * delete (dict):

    Timeout configuration for deletion of a Nat Gateway * delay: The amount of time in seconds to wait between attempts. * max_attempts: Customized timeout configuration containing delay and max attempts.

Request Syntax:
[nat_gateway-name]:
  aws.ec2.nat_gateway.absent:
    - name: 'string'
    - resource_id: 'string'
    - timeout:
        delete:
          delay: 'integer'
          max_attempts: 'integer'
Returns:

Dict[str, Any]

Examples

my-nat-gateway:
    aws.ec2.nat_gateway.absent:
      - name: my-nat-gateway
      - resource_id: nat-0e7969ddf4c38831f
async idem_aws.states.aws.ec2.nat_gateway.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function

Describes one or more of your NAT gateways.

Returns:

Dict[str, Any]

Examples

$ idem describe aws.ec2.nat_gateway