Amazon Elastic Compute Cloud

2024/08/28 - Amazon Elastic Compute Cloud - 4 updated api methods

Changes  Amazon VPC IP Address Manager (IPAM) now allows customers to provision IPv4 CIDR blocks and allocate Elastic IP Addresses directly from IPAM pools with public IPv4 space

AllocateAddress (updated) Link ¶
Changes (request)
{'IpamPoolId': 'string'}

Allocates an Elastic IP address to your Amazon Web Services account. After you allocate the Elastic IP address you can associate it with an instance or network interface. After you release an Elastic IP address, it is released to the IP address pool and can be allocated to a different Amazon Web Services account.

You can allocate an Elastic IP address from an address pool owned by Amazon Web Services or from an address pool created from a public IPv4 address range that you have brought to Amazon Web Services for use with your Amazon Web Services resources using bring your own IP addresses (BYOIP). For more information, see Bring Your Own IP Addresses (BYOIP) in the Amazon EC2 User Guide .

If you release an Elastic IP address, you might be able to recover it. You cannot recover an Elastic IP address that you released after it is allocated to another Amazon Web Services account. To attempt to recover an Elastic IP address that you released, specify it in this operation.

For more information, see Elastic IP Addresses in the Amazon EC2 User Guide .

You can allocate a carrier IP address which is a public IP address from a telecommunication carrier, to a network interface which resides in a subnet in a Wavelength Zone (for example an EC2 instance).

See also: AWS API Documentation

Request Syntax

client.allocate_address(
    Domain='vpc'|'standard',
    Address='string',
    PublicIpv4Pool='string',
    NetworkBorderGroup='string',
    CustomerOwnedIpv4Pool='string',
    DryRun=True|False,
    TagSpecifications=[
        {
            'ResourceType': 'capacity-reservation'|'client-vpn-endpoint'|'customer-gateway'|'carrier-gateway'|'coip-pool'|'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'|'ipam'|'ipam-pool'|'ipam-scope'|'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'|'network-insights-access-scope'|'network-insights-access-scope-analysis'|'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'|'subnet-cidr-reservation'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-policy-table'|'transit-gateway-route-table'|'transit-gateway-route-table-announcement'|'volume'|'vpc'|'vpc-endpoint'|'vpc-endpoint-connection'|'vpc-endpoint-service'|'vpc-endpoint-service-permission'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log'|'capacity-reservation-fleet'|'traffic-mirror-filter-rule'|'vpc-endpoint-connection-device-type'|'verified-access-instance'|'verified-access-group'|'verified-access-endpoint'|'verified-access-policy'|'verified-access-trust-provider'|'vpn-connection-device-type'|'vpc-block-public-access-exclusion'|'ipam-resource-discovery'|'ipam-resource-discovery-association'|'instance-connect-endpoint'|'ipam-external-resource-verification-token',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    IpamPoolId='string'
)
type Domain

string

param Domain

The network ( vpc ).

type Address

string

param Address

The Elastic IP address to recover or an IPv4 address from an address pool.

type PublicIpv4Pool

string

param PublicIpv4Pool

The ID of an address pool that you own. Use this parameter to let Amazon EC2 select an address from the address pool. To specify a specific address from the address pool, use the Address parameter instead.

type NetworkBorderGroup

string

param NetworkBorderGroup

A unique set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses. Use this parameter to limit the IP address to this location. IP addresses cannot move between network border groups.

type CustomerOwnedIpv4Pool

string

param CustomerOwnedIpv4Pool

The ID of a customer-owned address pool. Use this parameter to let Amazon EC2 select an address from the address pool. Alternatively, specify a specific address from the address pool.

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 TagSpecifications

list

param TagSpecifications

The tags to assign to the Elastic IP address.

  • (dict) --

    The tags to apply to a resource when the resource is being created. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.

    Note

    The Valid Values lists all the resource types that can be tagged. However, the action you're using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you're using, you'll get an error.

    • 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 256 Unicode characters.

type IpamPoolId

string

param IpamPoolId

The ID of an IPAM pool.

rtype

dict

returns

Response Syntax

{
    'PublicIp': 'string',
    'AllocationId': 'string',
    'PublicIpv4Pool': 'string',
    'NetworkBorderGroup': 'string',
    'Domain': 'vpc'|'standard',
    'CustomerOwnedIp': 'string',
    'CustomerOwnedIpv4Pool': 'string',
    'CarrierIp': 'string'
}

Response Structure

  • (dict) --

    • PublicIp (string) --

      The Elastic IP address.

    • AllocationId (string) --

      The ID that represents the allocation of the Elastic IP address.

    • PublicIpv4Pool (string) --

      The ID of an address pool.

    • NetworkBorderGroup (string) --

      The set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses.

    • Domain (string) --

      The network ( vpc ).

    • CustomerOwnedIp (string) --

      The customer-owned IP address.

    • CustomerOwnedIpv4Pool (string) --

      The ID of the customer-owned address pool.

    • CarrierIp (string) --

      The carrier IP address. This option is only available for network interfaces that reside in a subnet in a Wavelength Zone.

AllocateIpamPoolCidr (updated) Link ¶
Changes (response)
{'IpamPoolAllocation': {'ResourceType': {'eip'}}}

Allocate a CIDR from an IPAM pool. The Region you use should be the IPAM pool locale. The locale is the Amazon Web Services Region where this IPAM pool is available for allocations.

In IPAM, an allocation is a CIDR assignment from an IPAM pool to another IPAM pool or to a resource. For more information, see Allocate CIDRs in the Amazon VPC IPAM User Guide .

Note

This action creates an allocation with strong consistency. The returned CIDR will not overlap with any other allocations from the same pool.

See also: AWS API Documentation

Request Syntax

client.allocate_ipam_pool_cidr(
    DryRun=True|False,
    IpamPoolId='string',
    Cidr='string',
    NetmaskLength=123,
    ClientToken='string',
    Description='string',
    PreviewNextCidr=True|False,
    AllowedCidrs=[
        'string',
    ],
    DisallowedCidrs=[
        'string',
    ]
)
type DryRun

boolean

param DryRun

A check for 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 IpamPoolId

string

param IpamPoolId

[REQUIRED]

The ID of the IPAM pool from which you would like to allocate a CIDR.

type Cidr

string

param Cidr

The CIDR you would like to allocate from the IPAM pool. Note the following:

  • If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.

  • If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.

Possible values: Any available IPv4 or IPv6 CIDR.

type NetmaskLength

integer

param NetmaskLength

The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:

  • If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.

  • If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.

Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.

type ClientToken

string

param ClientToken

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

type Description

string

param Description

A description for the allocation.

type PreviewNextCidr

boolean

param PreviewNextCidr

A preview of the next available CIDR in a pool.

type AllowedCidrs

list

param AllowedCidrs

Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.

  • (string) --

type DisallowedCidrs

list

param DisallowedCidrs

Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'IpamPoolAllocation': {
        'Cidr': 'string',
        'IpamPoolAllocationId': 'string',
        'Description': 'string',
        'ResourceId': 'string',
        'ResourceType': 'ipam-pool'|'vpc'|'ec2-public-ipv4-pool'|'custom'|'subnet'|'eip',
        'ResourceRegion': 'string',
        'ResourceOwner': 'string'
    }
}

Response Structure

  • (dict) --

    • IpamPoolAllocation (dict) --

      Information about the allocation created.

      • Cidr (string) --

        The CIDR for the allocation. A CIDR is a representation of an IP address and its associated network mask (or netmask) and refers to a range of IP addresses. An IPv4 CIDR example is 10.24.34.0/23 . An IPv6 CIDR example is 2001:DB8::/32 .

      • IpamPoolAllocationId (string) --

        The ID of an allocation.

      • Description (string) --

        A description of the pool allocation.

      • ResourceId (string) --

        The ID of the resource.

      • ResourceType (string) --

        The type of the resource.

      • ResourceRegion (string) --

        The Amazon Web Services Region of the resource.

      • ResourceOwner (string) --

        The owner of the resource.

GetIpamDiscoveredPublicAddresses (updated) Link ¶
Changes (response)
{'IpamDiscoveredPublicAddresses': {'AddressType': {'amazon-owned-contig'}}}

Gets the public IP addresses that have been discovered by IPAM.

See also: AWS API Documentation

Request Syntax

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

boolean

param DryRun

A check for 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 IpamResourceDiscoveryId

string

param IpamResourceDiscoveryId

[REQUIRED]

An IPAM resource discovery ID.

type AddressRegion

string

param AddressRegion

[REQUIRED]

The Amazon Web Services Region for the IP address.

type Filters

list

param Filters

Filters.

  • (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.

    If you specify multiple filters, the filters are joined with an AND , and the request returns only results that match all of the specified filters.

    • Name (string) --

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

    • Values (list) --

      The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR , and the request returns all results that match any of the specified values.

      • (string) --

type NextToken

string

param NextToken

The token for the next page of results.

type MaxResults

integer

param MaxResults

The maximum number of IPAM discovered public addresses to return in one page of results.

rtype

dict

returns

Response Syntax

{
    'IpamDiscoveredPublicAddresses': [
        {
            'IpamResourceDiscoveryId': 'string',
            'AddressRegion': 'string',
            'Address': 'string',
            'AddressOwnerId': 'string',
            'AddressAllocationId': 'string',
            'AssociationStatus': 'associated'|'disassociated',
            'AddressType': 'service-managed-ip'|'service-managed-byoip'|'amazon-owned-eip'|'amazon-owned-contig'|'byoip'|'ec2-public-ip',
            'Service': 'nat-gateway'|'database-migration-service'|'redshift'|'elastic-container-service'|'relational-database-service'|'site-to-site-vpn'|'load-balancer'|'global-accelerator'|'other',
            'ServiceResource': 'string',
            'VpcId': 'string',
            'SubnetId': 'string',
            'PublicIpv4PoolId': 'string',
            'NetworkInterfaceId': 'string',
            'NetworkInterfaceDescription': 'string',
            'InstanceId': 'string',
            'Tags': {
                'EipTags': [
                    {
                        'Key': 'string',
                        'Value': 'string'
                    },
                ]
            },
            'NetworkBorderGroup': 'string',
            'SecurityGroups': [
                {
                    'GroupName': 'string',
                    'GroupId': 'string'
                },
            ],
            'SampleTime': datetime(2015, 1, 1)
        },
    ],
    'OldestSampleTime': datetime(2015, 1, 1),
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • IpamDiscoveredPublicAddresses (list) --

      IPAM discovered public addresses.

      • (dict) --

        A public IP Address discovered by IPAM.

        • IpamResourceDiscoveryId (string) --

          The resource discovery ID.

        • AddressRegion (string) --

          The Region of the resource the IP address is assigned to.

        • Address (string) --

          The IP address.

        • AddressOwnerId (string) --

          The ID of the owner of the resource the IP address is assigned to.

        • AddressAllocationId (string) --

          The allocation ID of the resource the IP address is assigned to.

        • AssociationStatus (string) --

          The association status.

        • AddressType (string) --

          The IP address type.

        • Service (string) --

          The Amazon Web Services service associated with the IP address.

        • ServiceResource (string) --

          The resource ARN or ID.

        • VpcId (string) --

          The ID of the VPC that the resource with the assigned IP address is in.

        • SubnetId (string) --

          The ID of the subnet that the resource with the assigned IP address is in.

        • PublicIpv4PoolId (string) --

          The ID of the public IPv4 pool that the resource with the assigned IP address is from.

        • NetworkInterfaceId (string) --

          The network interface ID of the resource with the assigned IP address.

        • NetworkInterfaceDescription (string) --

          The description of the network interface that IP address is assigned to.

        • InstanceId (string) --

          The instance ID of the instance the assigned IP address is assigned to.

        • Tags (dict) --

          Tags associated with the IP address.

          • EipTags (list) --

            Tags for an Elastic IP address.

            • (dict) --

              A tag for a public IP address discovered by IPAM.

              • Key (string) --

                The tag's key.

              • Value (string) --

                The tag's value.

        • NetworkBorderGroup (string) --

          The Availability Zone (AZ) or Local Zone (LZ) network border group that the resource that the IP address is assigned to is in. Defaults to an AZ network border group. For more information on available Local Zones, see Local Zone availability in the Amazon EC2 User Guide .

        • SecurityGroups (list) --

          Security groups associated with the resource that the IP address is assigned to.

          • (dict) --

            The security group that the resource with the public IP address is in.

            • GroupName (string) --

              The security group's name.

            • GroupId (string) --

              The security group's ID.

        • SampleTime (datetime) --

          The last successful resource discovery time.

    • OldestSampleTime (datetime) --

      The oldest successful resource discovery time.

    • 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.

GetIpamPoolAllocations (updated) Link ¶
Changes (response)
{'IpamPoolAllocations': {'ResourceType': {'eip'}}}

Get a list of all the CIDR allocations in an IPAM pool. The Region you use should be the IPAM pool locale. The locale is the Amazon Web Services Region where this IPAM pool is available for allocations.

Note

If you use this action after AllocateIpamPoolCidr or ReleaseIpamPoolAllocation, note that all EC2 API actions follow an eventual consistency model.

See also: AWS API Documentation

Request Syntax

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

boolean

param DryRun

A check for 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 IpamPoolId

string

param IpamPoolId

[REQUIRED]

The ID of the IPAM pool you want to see the allocations for.

type IpamPoolAllocationId

string

param IpamPoolAllocationId

The ID of the allocation.

type Filters

list

param Filters

One or more filters for the request. For more information about filtering, see Filtering CLI output.

  • (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.

    If you specify multiple filters, the filters are joined with an AND , and the request returns only results that match all of the specified filters.

    • Name (string) --

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

    • Values (list) --

      The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR , and the request returns all results that match any of the specified values.

      • (string) --

type MaxResults

integer

param MaxResults

The maximum number of results you would like returned per page.

type NextToken

string

param NextToken

The token for the next page of results.

rtype

dict

returns

Response Syntax

{
    'IpamPoolAllocations': [
        {
            'Cidr': 'string',
            'IpamPoolAllocationId': 'string',
            'Description': 'string',
            'ResourceId': 'string',
            'ResourceType': 'ipam-pool'|'vpc'|'ec2-public-ipv4-pool'|'custom'|'subnet'|'eip',
            'ResourceRegion': 'string',
            'ResourceOwner': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • IpamPoolAllocations (list) --

      The IPAM pool allocations you want information on.

      • (dict) --

        In IPAM, an allocation is a CIDR assignment from an IPAM pool to another IPAM pool or to a resource.

        • Cidr (string) --

          The CIDR for the allocation. A CIDR is a representation of an IP address and its associated network mask (or netmask) and refers to a range of IP addresses. An IPv4 CIDR example is 10.24.34.0/23 . An IPv6 CIDR example is 2001:DB8::/32 .

        • IpamPoolAllocationId (string) --

          The ID of an allocation.

        • Description (string) --

          A description of the pool allocation.

        • ResourceId (string) --

          The ID of the resource.

        • ResourceType (string) --

          The type of the resource.

        • ResourceRegion (string) --

          The Amazon Web Services Region of the resource.

        • ResourceOwner (string) --

          The owner of the resource.

    • 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.