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

Class: Aws::EC2::NetworkInterface

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

Overloads:

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

    Parameters:

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

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

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

Instance Attribute Details

#attachmentTypes::NetworkInterfaceAttachment (readonly)

The network interface attachment.

Returns:

#availability_zoneString (readonly)

The Availability Zone.

Returns:

  • (String)

    The Availability Zone.

#descriptionString (readonly)

A description.

Returns:

  • (String)

    A description.

#groupsArray<Types::GroupIdentifier> (readonly)

Any security groups for the network interface.

Returns:

#idString (readonly)

Returns:

  • (String)

#interface_typeString (readonly)

The type of network interface.

Possible values:

  • interface
  • natGateway
  • efa

Returns:

  • (String)

    The type of network interface.

#ipv_6_addressesArray<Types::NetworkInterfaceIpv6Address> (readonly)

The IPv6 addresses associated with the network interface.

Returns:

#mac_addressString (readonly)

The MAC address.

Returns:

  • (String)

    The MAC address.

#network_interface_idString (readonly)

The ID of the network interface.

Returns:

  • (String)

    The ID of the network interface.

#outpost_arnString (readonly)

The Amazon Resource Name (ARN) of the Outpost.

Returns:

  • (String)

    The Amazon Resource Name (ARN) of the Outpost.

#owner_idString (readonly)

The AWS account ID of the owner of the network interface.

Returns:

  • (String)

    The AWS account ID of the owner of the network interface.

#private_dns_nameString (readonly)

The private DNS name.

Returns:

  • (String)

    The private DNS name.

#private_ip_addressString (readonly)

The IPv4 address of the network interface within the subnet.

Returns:

  • (String)

    The IPv4 address of the network interface within the subnet.

#private_ip_addressesArray<Types::NetworkInterfacePrivateIpAddress> (readonly)

The private IPv4 addresses associated with the network interface.

Returns:

#requester_idString (readonly)

The ID of the entity that launched the instance on your behalf (for example, AWS Management Console or Auto Scaling).

Returns:

  • (String)

    The ID of the entity that launched the instance on your behalf (for example, AWS Management Console or Auto Scaling).

#requester_managedBoolean (readonly)

Indicates whether the network interface is being managed by AWS.

Returns:

  • (Boolean)

    Indicates whether the network interface is being managed by AWS.

#source_dest_checkBoolean (readonly)

Indicates whether traffic to or from the instance is validated.

Returns:

  • (Boolean)

    Indicates whether traffic to or from the instance is validated.

#statusString (readonly)

The status of the network interface.

Possible values:

  • available
  • associated
  • attaching
  • in-use
  • detaching

Returns:

  • (String)

    The status of the network interface.

#subnet_idString (readonly)

The ID of the subnet.

Returns:

  • (String)

    The ID of the subnet.

#tag_setArray<Types::Tag> (readonly)

Any tags assigned to the network interface.

Returns:

  • (Array<Types::Tag>)

    Any tags assigned to the network interface.

#vpc_idString (readonly)

The ID of the VPC.

Returns:

  • (String)

    The ID of the VPC.

Instance Method Details

#assign_private_ip_addresses(options = {}) ⇒ Types::AssignPrivateIpAddressesResult

Assigns one or more secondary private IP addresses to the specified network interface.

You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Instance Types in the Amazon Elastic Compute Cloud User Guide. For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

When you move a secondary private IP address to another network interface, any Elastic IP address that is associated with the IP address is also moved.

Remapping an IP address is an asynchronous operation. When you move an IP address from one network interface to another, check network/interfaces/macs/mac/local-ipv4s in the instance metadata to confirm that the remapping is complete.

You must specify either the IP addresses or the IP address count in the request.

Examples:

Request syntax example with placeholder values


networkinterface.assign_private_ip_addresses({
  allow_reassignment: false,
  private_ip_addresses: ["String"],
  secondary_private_ip_address_count: 1,
})

Options Hash (options):

  • :allow_reassignment (Boolean)

    Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

  • :private_ip_addresses (Array<String>)

    One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can\'t specify this parameter when also specifying a number of secondary IP addresses.

    If you don\'t specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

  • :secondary_private_ip_address_count (Integer)

    The number of secondary IP addresses to assign to the network interface. You can\'t specify this parameter when also specifying private IP addresses.

Returns:

See Also:

#associationNetworkInterfaceAssociation?

Returns:

#attach(options = {}) ⇒ Types::AttachNetworkInterfaceResult

Attaches a network interface to an instance.

Examples:

Request syntax example with placeholder values


networkinterface.attach({
  device_index: 1, # required
  dry_run: false,
  instance_id: "InstanceId", # required
  network_card_index: 1,
})

Options Hash (options):

  • :device_index (required, Integer)

    The index of the device for the network interface attachment.

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

  • :instance_id (required, String)

    The ID of the instance.

  • :network_card_index (Integer)

    The index of the network card. Some instance types support multiple network cards. The primary network interface must be assigned to network card index 0. The default is network card index 0.

Returns:

See Also:

#create_tags(options = {}) ⇒ Array<Tag>

Examples:

Request syntax example with placeholder values


networkinterface.create_tags({
  dry_run: false,
  tags: [ # required
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

tags = networkinterface.create_tags(options)
tags.map(&:value)
#=> ["tag-value", ...]

Options Hash (options):

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

  • :tags (required, Array<Types::Tag>)

    The tags. The value parameter is required, but if you don\'t want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.

Returns:

See Also:

#delete(options = {}) ⇒ Struct

Deletes the specified network interface. You must detach the network interface before you can delete it.

Examples:

Request syntax example with placeholder values


networkinterface.delete({
  dry_run: false,
})

Options Hash (options):

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

#delete_tags(options = {}) ⇒ Array<Tag>

Examples:

Request syntax example with placeholder values


networkinterface.delete_tags({
  dry_run: false,
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

tags = networkinterface.delete_tags(options)
tags.map(&:value)
#=> ["tag-value", ...]

Options Hash (options):

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

  • :tags (Array<Types::Tag>)

    The tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty string.

    If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete AWS-generated tags (tags that have the aws: prefix).

Returns:

See Also:

#describe_attribute(options = {}) ⇒ Types::DescribeNetworkInterfaceAttributeResult

Describes a network interface attribute. You can specify only one attribute at a time.

Examples:

Request syntax example with placeholder values


networkinterface.describe_attribute({
  attribute: "description", # accepts description, groupSet, sourceDestCheck, attachment
  dry_run: false,
})

Options Hash (options):

  • :attribute (String)

    The attribute of the network interface. This parameter is required.

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

See Also:

#detach(options = {}) ⇒ Struct

Detaches a network interface from an instance.

Examples:

Request syntax example with placeholder values


networkinterface.detach({
  dry_run: false,
  force: false,
})

Options Hash (options):

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

  • :force (Boolean)

    Specifies whether to force a detachment.

    * Use the Force parameter only as a last resort to detach a network interface from a failed instance.

    • If you use the Force parameter to detach a network interface, you might not be able to attach a different network interface to the same index on the instance without first stopping and starting the instance.

    • If you force the detachment of a network interface, the instance metadata might not get updated. This means that the attributes associated with the detached network interface might still be visible. The instance metadata will get updated when you stop and start the instance.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#modify_attribute(options = {}) ⇒ Struct

Modifies the specified network interface attribute. You can specify only one attribute at a time. You can use this action to attach and detach security groups from an existing EC2 instance.

Examples:

Request syntax example with placeholder values


networkinterface.modify_attribute({
  attachment: {
    attachment_id: "NetworkInterfaceAttachmentId",
    delete_on_termination: false,
  },
  description: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
  dry_run: false,
  groups: ["SecurityGroupId"],
  source_dest_check: {
    value: false,
  },
})

Options Hash (options):

  • :attachment (Types::NetworkInterfaceAttachmentChanges)

    Information about the interface attachment. If modifying the \'delete on termination\' attribute, you must specify the ID of the interface attachment.

  • :description (Types::AttributeValue)

    A description for the network interface.

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

  • :groups (Array<String>)

    Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it\'s just the default security group in the VPC. You must specify the ID of the security group, not the name.

  • :source_dest_check (Types::AttributeBooleanValue)

    Indicates whether source/destination checking is enabled. A value of true means checking is enabled, and false means checking is disabled. This value must be false for a NAT instance to perform NAT. For more information, see NAT Instances in the Amazon Virtual Private Cloud User Guide.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#reset_attribute(options = {}) ⇒ Struct

Resets a network interface attribute. You can specify only one attribute at a time.

Examples:

Request syntax example with placeholder values


networkinterface.reset_attribute({
  dry_run: false,
  source_dest_check: "String",
})

Options Hash (options):

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

  • :source_dest_check (String)

    The source/destination checking attribute. Resets the value to true.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#subnetSubnet?

Returns:

#unassign_private_ip_addresses(options = {}) ⇒ Struct

Unassigns one or more secondary private IP addresses from a network interface.

Examples:

Request syntax example with placeholder values


networkinterface.unassign_private_ip_addresses({
  private_ip_addresses: ["String"], # required
})

Options Hash (options):

  • :private_ip_addresses (required, Array<String>)

    The secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#vpcVpc?

Returns: