VM::EC...terface(3pm)
π VM::EC2::NetworkInterface β the manual page, but make it make sense π
okay bestie, gather round, because this is the page for VM::EC2::NetworkInterface(3pm) from the User Contributed Perl Documentation and it is genuinely iconic. it's giving "the object that tells you everything about an Amazon Elastic Network Interface (ENI)". periodt. π¦
β¨ NAME β¨
VM::EC2::NetworkInterface β the object that describes an Amazon Elastic Network Interface (ENI). that's it, that's the whole name section, slay. π
πΈ SYNOPSIS πΈ
the vibe, in code:
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";
look at her go. six little prints, zero notes. π
π DESCRIPTION π
so this object hands you all the info about Amazon Elastic Network Interface objects. these are the little guys used alongside virtual private cloud (VPC) instances to build multi-homed web servers, routers, firewalls, and so on. multi-homed? yes. main character energy? also yes. π
and psst β for the methods that every VM::EC2 object shares, go check out VM::EC2::Generic. π«Ά
π METHODS π
these object methods are supported, no cap:
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 ENI as a set ofVM::EC2::Groupobjects.attachmentβ information about the attachment of this ENI to an instance, as aVM::EC2::NetworkInterface::Attachmentobject.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 ofVM::EC2::NetworkInterface::PrivateIpAddressobjects.availabilityZoneβ availability zone for this ENI as aVM::EC2::AvailabilityZoneobject.macAddressβ MAC address for this interface.
(and yes, that privateDnsName line really does trail off into talking about VM::EC2::Group objects. i did not write that, i am merely the messenger. π)
in addition, this object supports the following convenience methods β the little quality-of-life queens:
resetAttributes()β return attributes to their default states. currently only sets theSourceDestCheckvalue 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 thedeleteOnTerminationflag is set for the current attachment. pass a boolean value to change the value.
π₯ Attaching to an instance π₯
these methods let the interface get attached to instances, and detached from them. it's giving situationship. π
$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 hand it 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.0foreth0).
on success, this method returns theattachmentIdof the new attachment β not aVM::EC2::NetworkInterface::Attachmentobject, due to an AWS API inconsistency. not me getting betrayed by the API mid-manpage π
$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. outsourcing, but make it cloud. βοΈ
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. sorry babe, no chaos combos. π«
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. breaking up is hard to do etc. π
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. she knows how to introduce herself. π
π¦ SEE ALSO π¦
VM::EC2VM::EC2::GenericVM::EC2::NetworkInterfaceVM::EC2::NetworkInterface::AttachmentVM::EC2::NetworkInterface::Association
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>.
Copyright (c) 2012 Ontario Institute for Cancer Research
this package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. refer to LICENSE for the full license text. in addition, please see DISCLAIMER.txt for disclaimers of warranty.
and that's the whole page, bestie π«Ά documented as part of perl v5.38.2, dated 2024-08-10, filed under VM::EC2::NetworkInterface(3pm). go forth and describe some network interfaces. slay. πβ¨π
π¦ where this page comes from
- debian trixie: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu resolute: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu stonking: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms