VM::EC2::NetworkInterface - Object describing an Amazon Elastic Network Interface (ENI)
Contents
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 in
use 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.
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.
Description
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 ENI
subnetId -- The ID of the subnet this ENI belongs to
vpcId -- The ID of the VPC this ENI belongs to
ownerId -- Owner of the ENI
status -- ENI status, one of "available" or "in-use"
privateIpAddress -- Primary private IP address of the ENI
privateDnsName -- Primary private DNS name of the ENI
as a set of VM::EC2::Group objects.
attachment -- Information about the attachment of this ENI to
an instance, as a VM::EC2::NetworkInterface::Attachment
object.
association -- Information about the association of this ENI with
an elastic public IP address.
privateIpAddresses -- List of private IP addresses assigned to this ENI,
as a list of VM::EC2::NetworkInterface::PrivateIpAddress
objects.
availabilityZone -- Availability zone for this ENI as a VM::EC2::AvailabilityZone
object.
macAddress -- MAC address for this interface.
In addition, this object supports the following convenience methods:
resetAttributes() -- Return attributes to their default states. Currently only
sets the SourceDestCheck value to true.
description([$new_value]) -- Description of the ENI. Pass a single argument to set a new
description
sourceDestCheck([$boolean])-- Boolean value. If true, prevent this ENI from
forwarding packets between subnets. Value can optionally
be set
security_groups([@new_groups]) -- List of security groups this ENI belongs to. Pass a
list of new security groups to change this value.
delete_on_termination([$boolean])
-- Whether the deleteOnTermination flag is set for the current
attachment. Pass a boolean value to change the value.
Name
VM::EC2::NetworkInterface - Object describing an Amazon Elastic Network Interface (ENI)
See Also
VM::EC2 VM::EC2::Generic VM::EC2::NetworkInterface VM::EC2::NetworkInterface::Attachment
VM::EC2::NetworkInterface::Association
String Overloading
When used in a string context, this object will be interpolated as the networkInterfaceId
Synopsis
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";
