VM::EC...Address(3pm)
π 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
- 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