You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::EC2::ClassicAddress

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(public_ip, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(public_ip, options = {}) ⇒ Object

    Parameters:

    • public_ip (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Aws::EC2::Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :public_ip (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Aws::EC2::Client object.

Instance Attribute Details

#allocation_idString (readonly)

The ID representing the allocation of the address for use with EC2-VPC.

Returns:

  • (String)

    The ID representing the allocation of the address for use with EC2-VPC.

#association_idString (readonly)

The ID representing the association of the address with an instance in a VPC.

Returns:

  • (String)

    The ID representing the association of the address with an instance in a VPC.

#carrier_ipString (readonly)

The carrier IP address associated. This option is only available for network interfaces which reside in a subnet in a Wavelength Zone (for example an EC2 instance).

Returns:

  • (String)

    The carrier IP address associated.

#customer_owned_ipString (readonly)

The customer-owned IP address.

Returns:

  • (String)

    The customer-owned IP address.

#customer_owned_ipv_4_poolString (readonly)

The ID of the customer-owned address pool.

Returns:

  • (String)

    The ID of the customer-owned address pool.

#domainString (readonly)

Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Possible values:

  • vpc
  • standard

Returns:

  • (String)

    Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

#instance_idString (readonly)

The ID of the instance that the address is associated with (if any).

Returns:

  • (String)

    The ID of the instance that the address is associated with (if any).

#network_border_groupString (readonly)

The name of the unique set of Availability Zones, Local Zones, or Wavelength Zones from which AWS advertises IP addresses.

Returns:

  • (String)

    The name of the unique set of Availability Zones, Local Zones, or Wavelength Zones from which AWS advertises IP addresses.

#network_interface_idString (readonly)

The ID of the network interface.

Returns:

  • (String)

    The ID of the network interface.

#network_interface_owner_idString (readonly)

The ID of the AWS account that owns the network interface.

Returns:

  • (String)

    The ID of the AWS account that owns the network interface.

#private_ip_addressString (readonly)

The private IP address associated with the Elastic IP address.

Returns:

  • (String)

    The private IP address associated with the Elastic IP address.

#public_ipString (readonly)

Returns:

  • (String)

#public_ipv_4_poolString (readonly)

The ID of an address pool.

Returns:

  • (String)

    The ID of an address pool.

#tagsArray<Types::Tag> (readonly)

Any tags assigned to the Elastic IP address.

Returns:

  • (Array<Types::Tag>)

    Any tags assigned to the Elastic IP address.

Instance Method Details

#associate(options = {}) ⇒ Types::AssociateAddressResult

Associates an Elastic IP address, or carrier IP address (for instances that are in subnets in Wavelength Zones) with an instance or a network interface. Before you can use an Elastic IP address, you must allocate it to your account.

An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

[EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address is already associated with a different instance, it is disassociated from that instance and associated with the specified instance. If you associate an Elastic IP address with an instance that has an existing Elastic IP address, the existing address is disassociated from the instance, but remains allocated to your account.

[VPC in an EC2-Classic account] If you don't specify a private IP address, the Elastic IP address is associated with the primary IP address. If the Elastic IP address is already associated with a different instance or a network interface, you get an error unless you allow reassociation. You cannot associate an Elastic IP address with an instance or network interface that has an existing Elastic IP address.

[Subnets in Wavelength Zones] You can associate an IP address from the telecommunication carrier to the instance or network interface.

You cannot associate an Elastic IP address with an interface in a different network border group.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error, and you may be charged for each time the Elastic IP address is remapped to the same instance. For more information, see the Elastic IP Addresses section of Amazon EC2 Pricing.

Examples:

Request syntax example with placeholder values


classicaddress.associate({
  allocation_id: "AllocationId",
  instance_id: "InstanceId",
  allow_reassociation: false,
  dry_run: false,
  network_interface_id: "NetworkInterfaceId",
  private_ip_address: "String",
})

Options Hash (options):

  • :allocation_id (String)

    [EC2-VPC] The allocation ID. This is required for EC2-VPC.

  • :instance_id (String)

    The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.

  • :allow_reassociation (Boolean)

    [EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow an Elastic IP address that is already associated with an instance or network interface to be reassociated with the specified instance or network interface. Otherwise, the operation fails. In a VPC in an EC2-VPC-only account, reassociation is automatic, therefore you can specify false to ensure the operation fails if the Elastic IP address is already associated with another resource.

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

  • :network_interface_id (String)

    [EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.

    For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both.

  • :private_ip_address (String)

    [EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

Returns:

See Also:

#disassociate(options = {}) ⇒ Struct

Disassociates an Elastic IP address from the instance or network interface it's associated with.

An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.

Examples:

Request syntax example with placeholder values


classicaddress.disassociate({
  association_id: "ElasticIpAssociationId",
  dry_run: false,
})

Options Hash (options):

  • :association_id (String)

    [EC2-VPC] The association ID. Required for EC2-VPC.

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#release(options = {}) ⇒ Struct

Releases the specified Elastic IP address.

[EC2-Classic, default VPC] Releasing an Elastic IP address automatically disassociates it from any instance that it's associated with. To disassociate an Elastic IP address without releasing it, use DisassociateAddress.

[Nondefault VPC] You must use DisassociateAddress to disassociate the Elastic IP address before you can release it. Otherwise, Amazon EC2 returns an error (InvalidIPAddress.InUse).

After releasing an Elastic IP address, it is released to the IP address pool. Be sure to update your DNS records and any servers or devices that communicate with the address. If you attempt to release an Elastic IP address that you already released, you'll get an AuthFailure error if the address is already allocated to another AWS account.

[EC2-VPC] After you release an Elastic IP address for use in a VPC, you might be able to recover it. For more information, see AllocateAddress.

Examples:

Request syntax example with placeholder values


classicaddress.release({
  allocation_id: "AllocationId",
  network_border_group: "String",
  dry_run: false,
})

Options Hash (options):

  • :allocation_id (String)

    [EC2-VPC] The allocation ID. Required for EC2-VPC.

  • :network_border_group (String)

    The set of Availability Zones, Local Zones, or Wavelength Zones from which AWS advertises IP addresses.

    If you provide an incorrect network border group, you will receive an InvalidAddress.NotFound error. For more information, see Error Codes.

    You cannot use a network border group with EC2 Classic. If you attempt this operation on EC2 classic, you will receive an InvalidParameterCombination error. For more information, see Error Codes.

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

Returns:

  • (Struct)

    Returns an empty response.

See Also: