VM::EC2::NetworkInterface3pm
Object describing an amazon elastic network interface (eni)
Usage
use VM::EC2;my $ec2 = VM::EC2->new(...);my $interface = $ec2->describe_network_interfaces('eni-12345');print $interface->subNetId,"\n",$interface->description,"\n",$interface->vpcId,"\n",$interface->status,"\n",$interface->privateIpAddress,"\n",$interface->macAddress,"\n";
Overview
This object provides access to information about Amazon Elastic Network Interface objects, which are used in conjunction with virtual private cloud (VPC) instances to create multi-homed web servers, routers, firewalls, and so forth.
Please see VM::EC2::Generic for methods shared by all VM::EC2 objects.
Methods
These object methods are supported:
networkInterfaceId -- The ID of this ENIsubnetId -- The ID of the subnet this ENI belongs tovpcId -- The ID of the VPC this ENI belongs toownerId -- Owner of the ENIstatus -- ENI status, one of "available" or "in-use"privateIpAddress -- Primary private IP address of the ENIprivateDnsName -- Primary private DNS name of the ENIas a set of VM::EC2::Group objects.attachment -- Information about the attachment of this ENI toan instance, as a VM::EC2::NetworkInterface::Attachmentobject.association -- Information about the association of this ENI withan elastic public IP address.privateIpAddresses -- List of private IP addresses assigned to this ENI,as a list of VM::EC2::NetworkInterface::PrivateIpAddressobjects.availabilityZone -- Availability zone for this ENI as a VM::EC2::AvailabilityZoneobject.macAddress -- MAC address for this interface.
In addition, this object supports the following convenience methods:
resetAttributes() -- Return attributes to their default states. Currently onlysets the SourceDestCheck value to true.description([$new_value]) -- Description of the ENI. Pass a single argument to set a newdescriptionsourceDestCheck([$boolean])-- Boolean value. If true, prevent this ENI fromforwarding packets between subnets. Value can optionallybe setsecurity_groups([@new_groups]) -- List of security groups this ENI belongs to. Pass alist of new security groups to change this value.delete_on_termination([$boolean])-- Whether the deleteOnTermination flag is set for the currentattachment. Pass a boolean value to change the value.
Attaching to an instance
The following methods allow the interface to be attached to, and detached from, instances.
$attachment_id = $interface->attach($instance_id => $device)
$attachment_id = $interfacee->attach(-instance_id => $id, -device_index => $device)
This method attaches the network interface an instance using the the indicated device index. You can provide either an instance ID, or a VM::EC2::Instance object. You may use an integer for -device_index, or use the strings "eth0", "eth1" etc.
Required arguments:
-instance_id ID of the instance to attach to.-device_index Network device number to use (e.g. 0 for eth0).
On success, this method returns the attachmentId of the new attachment (not a VM::EC2::NetworkInterface::Attachment object, due to an AWS API inconsistency).
$boolean = $interface->detach([$force])
This method detaches the network interface from whatever instance it is currently attached to. If a true argument is provided, then the detachment will be forced, even if the interface is in use.
On success, this method returns a true value.
Adding IP addresses
$result = $interface->assign_private_ip_addresses(@addresses)
$result = $interface->assign_private_ip_addresses(%args)
Assign one or more secondary private IP addresses to the network interface. You can either set the addresses explicitly, or provide a count of secondary addresses, and let Amazon select them for you.
In the list argument form, pass a list of desired IP addresses, or a count of the number of addresses to select for you:
$interface->assign_private_ip_addresses(3); # three automatic addresses$interface->assign_private_ip_addresses('192.168.0.10','192.168.0.11');
Required arguments:
-private_ip_address One or more secondary IP addresses, as a scalar string-private_ip_addresses or array reference. (The two arguments are equivalent).
Optional arguments:
-allow_reassignment If true, allow assignment of an IP address is already inuse by another network interface or instance.
The following are valid arguments to -private_ip_address:
-private_ip_address => '192.168.0.12' # single address-private_ip_address => ['192.168.0.12','192.168.0.13] # multiple addresses-private_ip_address => 3 # autoselect three addresses
The mixed form of address, such as ['192.168.0.12','auto'] is not allowed in this call.
On success, this method returns true.
$result = $interface->unassign_private_ip_addresses(@addresses)
$result = $interface->unassign_private_ip_addresses(-private_ip_address => \@addresses)
Unassign one or more secondary private IP addresses from the network interface.
In the list argument form, pass a list of desired IP addresses to unassign.
$interface->assign_private_ip_addresses('192.168.0.10','192.168.0.11');
In the named argument form, use:
-private_ip_address One or more secondary IP addresses, as a scalar string-private_ip_addresses or array reference. (The two arguments are equivalent).
The following are valid arguments to -private_ip_address:
-private_ip_address => '192.168.0.12' # single address-private_ip_address => ['192.168.0.12','192.168.0.13] # multiple addresses
On success, this method returns true.
String overloading
When used in a string context, this object will be interpolated as the networkInterfaceId
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.