Amazon Elastic Compute Cloud

2021/11/15 - Amazon Elastic Compute Cloud - 4 updated api methods

Changes  Adds a new VPC Subnet attribute "EnableDns64." When enabled on IPv6 Subnets, the Amazon-Provided DNS Resolver returns synthetic IPv6 addresses for IPv4-only destinations.

CreateDefaultSubnet (updated) Link ¶
Changes (response)
{'Subnet': {'EnableDns64': 'boolean'}}

Creates a default subnet with a size /20 IPv4 CIDR block in the specified Availability Zone in your default VPC. You can have only one default subnet per Availability Zone. For more information, see Creating a default subnet in the Amazon Virtual Private Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.create_default_subnet(
    AvailabilityZone='string',
    DryRun=True|False
)
type AvailabilityZone

string

param AvailabilityZone

[REQUIRED]

The Availability Zone in which to create the default subnet.

type DryRun

boolean

param DryRun

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 .

rtype

dict

returns

Response Syntax

{
    'Subnet': {
        'AvailabilityZone': 'string',
        'AvailabilityZoneId': 'string',
        'AvailableIpAddressCount': 123,
        'CidrBlock': 'string',
        'DefaultForAz': True|False,
        'MapPublicIpOnLaunch': True|False,
        'MapCustomerOwnedIpOnLaunch': True|False,
        'CustomerOwnedIpv4Pool': 'string',
        'State': 'pending'|'available',
        'SubnetId': 'string',
        'VpcId': 'string',
        'OwnerId': 'string',
        'AssignIpv6AddressOnCreation': True|False,
        'Ipv6CidrBlockAssociationSet': [
            {
                'AssociationId': 'string',
                'Ipv6CidrBlock': 'string',
                'Ipv6CidrBlockState': {
                    'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
                    'StatusMessage': 'string'
                }
            },
        ],
        'Tags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'SubnetArn': 'string',
        'OutpostArn': 'string',
        'EnableDns64': True|False
    }
}

Response Structure

  • (dict) --

    • Subnet (dict) --

      Information about the subnet.

      • AvailabilityZone (string) --

        The Availability Zone of the subnet.

      • AvailabilityZoneId (string) --

        The AZ ID of the subnet.

      • AvailableIpAddressCount (integer) --

        The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.

      • CidrBlock (string) --

        The IPv4 CIDR block assigned to the subnet.

      • DefaultForAz (boolean) --

        Indicates whether this is the default subnet for the Availability Zone.

      • MapPublicIpOnLaunch (boolean) --

        Indicates whether instances launched in this subnet receive a public IPv4 address.

      • MapCustomerOwnedIpOnLaunch (boolean) --

        Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives a customer-owned IPv4 address.

      • CustomerOwnedIpv4Pool (string) --

        The customer-owned IPv4 address pool associated with the subnet.

      • State (string) --

        The current state of the subnet.

      • SubnetId (string) --

        The ID of the subnet.

      • VpcId (string) --

        The ID of the VPC the subnet is in.

      • OwnerId (string) --

        The ID of the Amazon Web Services account that owns the subnet.

      • AssignIpv6AddressOnCreation (boolean) --

        Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives an IPv6 address.

      • Ipv6CidrBlockAssociationSet (list) --

        Information about the IPv6 CIDR blocks associated with the subnet.

        • (dict) --

          Describes an IPv6 CIDR block associated with a subnet.

          • AssociationId (string) --

            The association ID for the CIDR block.

          • Ipv6CidrBlock (string) --

            The IPv6 CIDR block.

          • Ipv6CidrBlockState (dict) --

            Information about the state of the CIDR block.

            • State (string) --

              The state of a CIDR block.

            • StatusMessage (string) --

              A message about the status of the CIDR block, if applicable.

      • Tags (list) --

        Any tags assigned to the subnet.

        • (dict) --

          Describes a tag.

          • Key (string) --

            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 (string) --

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.

      • SubnetArn (string) --

        The Amazon Resource Name (ARN) of the subnet.

      • OutpostArn (string) --

        The Amazon Resource Name (ARN) of the Outpost.

      • EnableDns64 (boolean) --

        Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

CreateSubnet (updated) Link ¶
Changes (response)
{'Subnet': {'EnableDns64': 'boolean'}}

Creates a subnet in a specified VPC.

You must specify an IPv4 CIDR block for the subnet. After you create a subnet, you can't change its CIDR block. The allowed block size is between a /16 netmask (65,536 IP addresses) and /28 netmask (16 IP addresses). The CIDR block must not overlap with the CIDR block of an existing subnet in the VPC.

If you've associated an IPv6 CIDR block with your VPC, you can create a subnet with an IPv6 CIDR block that uses a /64 prefix length.

Warning

Amazon Web Services reserves both the first four and the last IPv4 address in each subnet's CIDR block. They're not available for use.

If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle.

When you stop an instance in a subnet, it retains its private IPv4 address. It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available.

For more information about subnets, see Your VPC and subnets in the Amazon Virtual Private Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.create_subnet(
    TagSpecifications=[
        {
            'ResourceType': 'capacity-reservation'|'client-vpn-endpoint'|'customer-gateway'|'carrier-gateway'|'dedicated-host'|'dhcp-options'|'egress-only-internet-gateway'|'elastic-ip'|'elastic-gpu'|'export-image-task'|'export-instance-task'|'fleet'|'fpga-image'|'host-reservation'|'image'|'import-image-task'|'import-snapshot-task'|'instance'|'instance-event-window'|'internet-gateway'|'ipv4pool-ec2'|'ipv6pool-ec2'|'key-pair'|'launch-template'|'local-gateway'|'local-gateway-route-table'|'local-gateway-virtual-interface'|'local-gateway-virtual-interface-group'|'local-gateway-route-table-vpc-association'|'local-gateway-route-table-virtual-interface-group-association'|'natgateway'|'network-acl'|'network-interface'|'network-insights-analysis'|'network-insights-path'|'placement-group'|'prefix-list'|'replace-root-volume-task'|'reserved-instances'|'route-table'|'security-group'|'security-group-rule'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-route-table'|'volume'|'vpc'|'vpc-endpoint'|'vpc-endpoint-service'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    AvailabilityZone='string',
    AvailabilityZoneId='string',
    CidrBlock='string',
    Ipv6CidrBlock='string',
    OutpostArn='string',
    VpcId='string',
    DryRun=True|False
)
type TagSpecifications

list

param TagSpecifications

The tags to assign to the subnet.

  • (dict) --

    The tags to apply to a resource when the resource is being created.

    • ResourceType (string) --

      The type of resource to tag on creation.

    • Tags (list) --

      The tags to apply to the resource.

      • (dict) --

        Describes a tag.

        • Key (string) --

          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 (string) --

          The value of the tag.

          Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.

type AvailabilityZone

string

param AvailabilityZone

The Availability Zone or Local Zone for the subnet.

Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.

To create a subnet in a Local Zone, set this value to the Local Zone ID, for example us-west-2-lax-1a . For information about the Regions that support Local Zones, see Available Regions in the Amazon Elastic Compute Cloud User Guide .

To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.

type AvailabilityZoneId

string

param AvailabilityZoneId

The AZ ID or the Local Zone ID of the subnet.

type CidrBlock

string

param CidrBlock

[REQUIRED]

The IPv4 network range for the subnet, in CIDR notation. For example, 10.0.0.0/24 . We modify the specified CIDR block to its canonical form; for example, if you specify 100.68.0.18/18 , we modify it to 100.68.0.0/18 .

type Ipv6CidrBlock

string

param Ipv6CidrBlock

The IPv6 network range for the subnet, in CIDR notation. The subnet size must use a /64 prefix length.

type OutpostArn

string

param OutpostArn

The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.

type VpcId

string

param VpcId

[REQUIRED]

The ID of the VPC.

type DryRun

boolean

param DryRun

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 .

rtype

dict

returns

Response Syntax

{
    'Subnet': {
        'AvailabilityZone': 'string',
        'AvailabilityZoneId': 'string',
        'AvailableIpAddressCount': 123,
        'CidrBlock': 'string',
        'DefaultForAz': True|False,
        'MapPublicIpOnLaunch': True|False,
        'MapCustomerOwnedIpOnLaunch': True|False,
        'CustomerOwnedIpv4Pool': 'string',
        'State': 'pending'|'available',
        'SubnetId': 'string',
        'VpcId': 'string',
        'OwnerId': 'string',
        'AssignIpv6AddressOnCreation': True|False,
        'Ipv6CidrBlockAssociationSet': [
            {
                'AssociationId': 'string',
                'Ipv6CidrBlock': 'string',
                'Ipv6CidrBlockState': {
                    'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
                    'StatusMessage': 'string'
                }
            },
        ],
        'Tags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'SubnetArn': 'string',
        'OutpostArn': 'string',
        'EnableDns64': True|False
    }
}

Response Structure

  • (dict) --

    • Subnet (dict) --

      Information about the subnet.

      • AvailabilityZone (string) --

        The Availability Zone of the subnet.

      • AvailabilityZoneId (string) --

        The AZ ID of the subnet.

      • AvailableIpAddressCount (integer) --

        The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.

      • CidrBlock (string) --

        The IPv4 CIDR block assigned to the subnet.

      • DefaultForAz (boolean) --

        Indicates whether this is the default subnet for the Availability Zone.

      • MapPublicIpOnLaunch (boolean) --

        Indicates whether instances launched in this subnet receive a public IPv4 address.

      • MapCustomerOwnedIpOnLaunch (boolean) --

        Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives a customer-owned IPv4 address.

      • CustomerOwnedIpv4Pool (string) --

        The customer-owned IPv4 address pool associated with the subnet.

      • State (string) --

        The current state of the subnet.

      • SubnetId (string) --

        The ID of the subnet.

      • VpcId (string) --

        The ID of the VPC the subnet is in.

      • OwnerId (string) --

        The ID of the Amazon Web Services account that owns the subnet.

      • AssignIpv6AddressOnCreation (boolean) --

        Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives an IPv6 address.

      • Ipv6CidrBlockAssociationSet (list) --

        Information about the IPv6 CIDR blocks associated with the subnet.

        • (dict) --

          Describes an IPv6 CIDR block associated with a subnet.

          • AssociationId (string) --

            The association ID for the CIDR block.

          • Ipv6CidrBlock (string) --

            The IPv6 CIDR block.

          • Ipv6CidrBlockState (dict) --

            Information about the state of the CIDR block.

            • State (string) --

              The state of a CIDR block.

            • StatusMessage (string) --

              A message about the status of the CIDR block, if applicable.

      • Tags (list) --

        Any tags assigned to the subnet.

        • (dict) --

          Describes a tag.

          • Key (string) --

            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 (string) --

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.

      • SubnetArn (string) --

        The Amazon Resource Name (ARN) of the subnet.

      • OutpostArn (string) --

        The Amazon Resource Name (ARN) of the Outpost.

      • EnableDns64 (boolean) --

        Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

DescribeSubnets (updated) Link ¶
Changes (response)
{'Subnets': {'EnableDns64': 'boolean'}}

Describes one or more of your subnets.

For more information, see Your VPC and subnets in the Amazon Virtual Private Cloud User Guide .

See also: AWS API Documentation

Request Syntax

client.describe_subnets(
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    SubnetIds=[
        'string',
    ],
    DryRun=True|False,
    NextToken='string',
    MaxResults=123
)
type Filters

list

param Filters

One or more filters.

  • availability-zone - The Availability Zone for the subnet. You can also use availabilityZone as the filter name.

  • availability-zone-id - The ID of the Availability Zone for the subnet. You can also use availabilityZoneId as the filter name.

  • available-ip-address-count - The number of IPv4 addresses in the subnet that are available.

  • cidr-block - The IPv4 CIDR block of the subnet. The CIDR block you specify must exactly match the subnet's CIDR block for information to be returned for the subnet. You can also use cidr or cidrBlock as the filter names.

  • default-for-az - Indicates whether this is the default subnet for the Availability Zone. You can also use defaultForAz as the filter name.

  • ipv6-cidr-block-association.ipv6-cidr-block - An IPv6 CIDR block associated with the subnet.

  • ipv6-cidr-block-association.association-id - An association ID for an IPv6 CIDR block associated with the subnet.

  • ipv6-cidr-block-association.state - The state of an IPv6 CIDR block associated with the subnet.

  • outpost-arn - The Amazon Resource Name (ARN) of the Outpost.

  • owner-id - The ID of the Amazon Web Services account that owns the subnet.

  • state - The state of the subnet ( pending | available ).

  • subnet-arn - The Amazon Resource Name (ARN) of the subnet.

  • subnet-id - The ID of the subnet.

  • tag :<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA , specify tag:Owner for the filter name and TeamA for the filter value.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • vpc-id - The ID of the VPC for the subnet.

  • (dict) --

    A filter name and value pair that is used to return a more specific list of results from a describe operation. Filters can be used to match a set of resources by specific criteria, such as tags, attributes, or IDs.

    • Name (string) --

      The name of the filter. Filter names are case-sensitive.

    • Values (list) --

      The filter values. Filter values are case-sensitive.

      • (string) --

type SubnetIds

list

param SubnetIds

One or more subnet IDs.

Default: Describes all your subnets.

  • (string) --

type DryRun

boolean

param DryRun

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 .

type NextToken

string

param NextToken

The token for the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value.

rtype

dict

returns

Response Syntax

{
    'Subnets': [
        {
            'AvailabilityZone': 'string',
            'AvailabilityZoneId': 'string',
            'AvailableIpAddressCount': 123,
            'CidrBlock': 'string',
            'DefaultForAz': True|False,
            'MapPublicIpOnLaunch': True|False,
            'MapCustomerOwnedIpOnLaunch': True|False,
            'CustomerOwnedIpv4Pool': 'string',
            'State': 'pending'|'available',
            'SubnetId': 'string',
            'VpcId': 'string',
            'OwnerId': 'string',
            'AssignIpv6AddressOnCreation': True|False,
            'Ipv6CidrBlockAssociationSet': [
                {
                    'AssociationId': 'string',
                    'Ipv6CidrBlock': 'string',
                    'Ipv6CidrBlockState': {
                        'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
                        'StatusMessage': 'string'
                    }
                },
            ],
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'SubnetArn': 'string',
            'OutpostArn': 'string',
            'EnableDns64': True|False
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Subnets (list) --

      Information about one or more subnets.

      • (dict) --

        Describes a subnet.

        • AvailabilityZone (string) --

          The Availability Zone of the subnet.

        • AvailabilityZoneId (string) --

          The AZ ID of the subnet.

        • AvailableIpAddressCount (integer) --

          The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.

        • CidrBlock (string) --

          The IPv4 CIDR block assigned to the subnet.

        • DefaultForAz (boolean) --

          Indicates whether this is the default subnet for the Availability Zone.

        • MapPublicIpOnLaunch (boolean) --

          Indicates whether instances launched in this subnet receive a public IPv4 address.

        • MapCustomerOwnedIpOnLaunch (boolean) --

          Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives a customer-owned IPv4 address.

        • CustomerOwnedIpv4Pool (string) --

          The customer-owned IPv4 address pool associated with the subnet.

        • State (string) --

          The current state of the subnet.

        • SubnetId (string) --

          The ID of the subnet.

        • VpcId (string) --

          The ID of the VPC the subnet is in.

        • OwnerId (string) --

          The ID of the Amazon Web Services account that owns the subnet.

        • AssignIpv6AddressOnCreation (boolean) --

          Indicates whether a network interface created in this subnet (including a network interface created by RunInstances ) receives an IPv6 address.

        • Ipv6CidrBlockAssociationSet (list) --

          Information about the IPv6 CIDR blocks associated with the subnet.

          • (dict) --

            Describes an IPv6 CIDR block associated with a subnet.

            • AssociationId (string) --

              The association ID for the CIDR block.

            • Ipv6CidrBlock (string) --

              The IPv6 CIDR block.

            • Ipv6CidrBlockState (dict) --

              Information about the state of the CIDR block.

              • State (string) --

                The state of a CIDR block.

              • StatusMessage (string) --

                A message about the status of the CIDR block, if applicable.

        • Tags (list) --

          Any tags assigned to the subnet.

          • (dict) --

            Describes a tag.

            • Key (string) --

              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 (string) --

              The value of the tag.

              Constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters.

        • SubnetArn (string) --

          The Amazon Resource Name (ARN) of the subnet.

        • OutpostArn (string) --

          The Amazon Resource Name (ARN) of the Outpost.

        • EnableDns64 (boolean) --

          Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

    • NextToken (string) --

      The token to use to retrieve the next page of results. This value is null when there are no more results to return.

ModifySubnetAttribute (updated) Link ¶
Changes (request)
{'EnableDns64': {'Value': 'boolean'}}

Modifies a subnet attribute. You can only modify one attribute at a time.

See also: AWS API Documentation

Request Syntax

client.modify_subnet_attribute(
    AssignIpv6AddressOnCreation={
        'Value': True|False
    },
    MapPublicIpOnLaunch={
        'Value': True|False
    },
    SubnetId='string',
    MapCustomerOwnedIpOnLaunch={
        'Value': True|False
    },
    CustomerOwnedIpv4Pool='string',
    EnableDns64={
        'Value': True|False
    }
)
type AssignIpv6AddressOnCreation

dict

param AssignIpv6AddressOnCreation

Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. This includes a network interface that's created when launching an instance into the subnet (the instance therefore receives an IPv6 address).

If you enable the IPv6 addressing feature for your subnet, your network interface or instance only receives an IPv6 address if it's created using version 2016-11-15 or later of the Amazon EC2 API.

  • Value (boolean) --

    The attribute value. The valid values are true or false .

type MapPublicIpOnLaunch

dict

param MapPublicIpOnLaunch

Specify true to indicate that network interfaces attached to instances created in the specified subnet should be assigned a public IPv4 address.

  • Value (boolean) --

    The attribute value. The valid values are true or false .

type SubnetId

string

param SubnetId

[REQUIRED]

The ID of the subnet.

type MapCustomerOwnedIpOnLaunch

dict

param MapCustomerOwnedIpOnLaunch

Specify true to indicate that network interfaces attached to instances created in the specified subnet should be assigned a customer-owned IPv4 address.

When this value is true , you must specify the customer-owned IP pool using CustomerOwnedIpv4Pool .

  • Value (boolean) --

    The attribute value. The valid values are true or false .

type CustomerOwnedIpv4Pool

string

param CustomerOwnedIpv4Pool

The customer-owned IPv4 address pool associated with the subnet.

You must set this value when you specify true for MapCustomerOwnedIpOnLaunch .

type EnableDns64

dict

param EnableDns64

Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

  • Value (boolean) --

    The attribute value. The valid values are true or false .

returns

None