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

Class: Aws::EC2::VpcAddress

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(allocation_id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

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

    Parameters:

    • allocation_id (String)

    Options Hash (options):

    • :client (Client)

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

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

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

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

Instance Attribute Details

#allocation_idString (readonly)

Returns:

  • (String)

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

#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_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)

The Elastic IP address.

Returns:

  • (String)

    The Elastic IP address.

Instance Method Details

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

Associates an Elastic IP address with an instance or a network interface.

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.

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


vpcaddress.associate({
  instance_id: "String",
  public_ip: "String",
  allow_reassociation: false,
  dry_run: false,
  network_interface_id: "String",
  private_ip_address: "String",
})

Options Hash (options):

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

  • :public_ip (String)

    The Elastic IP address. This is required for EC2-Classic.

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

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

#associationNetworkInterfaceAssociation?

Returns:

#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


vpcaddress.release({
  public_ip: "String",
  dry_run: false,
})

Options Hash (options):

  • :public_ip (String)

    [EC2-Classic] The Elastic IP address. Required for EC2-Classic.

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