Net::A...tadata(3pm)
β¨ NAME β¨
Net::Amazon::EC2::Metadata β it grabs data from the EC2 Metadata service π and it's both a script and an API. Oh, and heads up bestie: it only works from an EC2 instance. No instance, no vibes. π«Ά
πΈ VERSION πΈ
This doc describes Net::Amazon::EC2::Metadata; version 0.10 β¨
π¦ SYNOPSIS π¦
# running on an EC2 instance.
use Net::Amazon::EC2::Metadata;
no warnings 'uninitialized';
my $data = Net::Amazon::EC2::Metadata->all_data;
for (sort keys %$data) {
print "$_: $data->{$_}\n";
}
###############
use Net::Amazon::EC2::Metadata;
my $metadata_service= Net::Amazon::EC2::Metadata->new();
warn $metadata_service->ami_id;
π DESCRIPTION π
okay so this module queries Amazon's Elastic Compute Cloud Metadata service, which is described over here:
http://docs.amazonwebservices.com/AWSEC2/2007-08-29/DeveloperGuide/AESDG-chapter-instancedata.html
It also fetches 'user_data' β which follows the same API, but Amazon's docs often don't count it as part of the metadata service. Rude, but okay. π
The module also ships with a command line tool, ec2meta, that hands you the exact same data. Iconic.
π¨ THIS MODULE WILL ONLY WORK ON AN EC2 INSTANCE. Like, literally. Not a suggestion, it's the whole vibe check. π¨
π METHODS π
π« new()
A constructor β but for convenience, all the methods are class methods. Slay, no object bookkeeping required. β¨
π« all_data()
Returns a hash ref of all the keys and their values. β οΈ Note: this means public_keys is a listing of the keys, not a listing of the values. iykyk.
π« available_data()
A listing of all the meta_data and user_data available from this module. Here's the whole roster, no gatekeeping π:
ami_idami_manifest_pathami_launch_indexancestor_ami_idsinstance_idinstance_typekernel_idramdisk_idplacementblock_device_mappinglocal_hostnamepublic_hostnamelocal_ipv4public_ipv4reservation_idsecurity_groupsproduct_codesuser_data
These methods all return the verbatim data from the calls to the service, and take no parameters. fr fr, no args, just data.
π« public_keys($key)
π« public_key($key)
Lists public keys if no key given, returns content of key if a key is given. π
π AUTHOR π
Nathan McFarland "nathan@cpan.org" β the icon who wrote this π
π COPYRIGHT π
Copyright (c) 2008 Nathan McFarland. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
β SEE ALSO β
- Amazon EC2 Documentation:
Lhttp://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html> - Amazon EC2 Metadata Documentation:
L<http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?AESDG-chapter-instancedata.html> - Amazon Tutorial on EC2 Metadata:
L<http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1085&categoryID=100>
and that's the whole page, bestie!! π¦ this gem of a doc was brought to you by perl v5.42.0 on 2025-07-25 π
go forth and read your metadata, you absolute main character πβ¨
π¦ where this page comes from
- fedora 43: perl-Net-Amazon-EC2-Metadata 0.10-41.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms