VM::EC...terface(3pm)

πŸ“¦
version 1.28 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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 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.

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

πŸ”₯ 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. 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. 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::EC2
  • VM::EC2::Generic
  • VM::EC2::NetworkInterface
  • VM::EC2::NetworkInterface::Attachment
  • VM::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