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

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

πŸ’– VM::EC2::ElasticAddress β€” the whole vibe πŸ’–

okay so bestie, this is a page from the User Contributed Perl Documentation (manual section 3pm), and it's all about one glorious little object: the Amazon EC2 Elastic Address. yes, the IP that just refuses to change on you. iconic behavior honestly. 🫢


✨ NAME ✨

VM::EC2::ElasticAddress β€” an object that describes an Amazon EC2 Elastic Address. that's it, that's the whole job, and it does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

look at this little snippet, it's giving main character energy:

use VM::EC2;

$ec2     = VM::EC2->new(...);
$addr    = $ec2->allocate_address;

$ip      = $addr->publicIp;
$domain  = $addr->domain;
$allId   = $addr->allocationId;

you spin up a VM::EC2 object, you call allocate_address on it, and boom πŸ’₯ β€” you've got yourself an address object. then you just reach in and grab publicIp, domain, and allocationId whenever you need them. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

so this object is literally the representation of an Amazon EC2 elastic address, and the way you get one is by calling VM::EC2->allocate_address(). that method hands it right back to you, and then you're living the elastic IP dream. ✨


πŸ‘‘ METHODS πŸ‘‘

these are the object methods that have your back, fr fr:

  • publicIp β€” the public IP of the address. the actual star of the show. ⭐
  • domain β€” the type of address, and it's either "standard" or "vpc".
  • allocationId β€” for VPC addresses only, this is the allocation ID.
  • instanceId β€” if this address is associated with an instance, this is the ID of that instance.
  • associationId β€” if the address is a VPC elastic IP and it's associated with an instance, then this is the ID of the association.

and then, as a lil treat, here are the convenience methods too πŸŽ€:

πŸ“ $result = $addr->associate($instance_id)

this one associates your address with the instance ID you pass in β€” or with a VM::EC2::Instance object, whichever you've got. and if it works? the result code will be true for an ordinary EC2 Elastic IP, or it'll be equal to the associationId for a VPC Elastic IP address. slay.

🌈 $result = $addr->disassociate()

this breaks the association between your address and whatever instance it's currently linked up with. if it goes through, this method returns true. bye bestie πŸ‘‹

πŸ’œ $addr->refresh()

this is an internal function, okay, so don't come for it β€” it gets called after associate() and disassociate(), and its whole purpose in life is refreshing the address object's contents. underrated little helper honestly.


πŸ’« STRING OVERLOADING πŸ’«

the moment this object gets used in a string context, it'll interpolate the publicIp. so you can just drop it into a string and it knows what to do. the way that it just works. πŸ˜­πŸ’–


🌟 SEE ALSO 🌟

go check out these too, they're all in the same friend group:

  • VM::EC2
  • VM::EC2::Generic
  • VM::EC2::Instance

🌸 AUTHOR 🌸

Lincoln Stein <lincoln.stein@gmail.com>.

Copyright (c) 2011 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.

fr fr, read the LICENSE and DISCLAIMER.txt β€” they're the receipts, bestie, not decoration. πŸ’…

and that's a wrap on the VM::EC2::ElasticAddress page! this beauty ships with perl v5.38.2 and the page itself is dated 2024-08-10 (per the footer, which also names the page VM::EC...Address(3pm) because the header was too long for its own good 😭). go forth and allocate responsibly. πŸŽ€βœ¨

πŸ“¦ where this page comes from