New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ec2meta

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ec2meta

Easily retrieve meta-data, user-data, tags and other information about the current AWS EC2 instance

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ec2meta

Easily retrieve meta-data, user-data, tags and other information about the AWS EC2 instance where the command is executed.

The tool is designed to be used in shell scripts, to easily retrieve information about the current EC2 instance.

For example:

LOCAL_IP=`ec2meta meta local-ipv4`
echo $LOCAL_IP

The tool requires either the instance to have a valid IAM Role or the user executing it to have a valid ~/.aws/credentials file. In both cases, the credentials must be granted access to EC2 in readonly mode. Please see the documentation of the AWS Node.js SDK for more information.

Metadata

Retrieve any instance meta-data by path. The specified path is concatenated to http://169.254.169.254/latest/meta-data/.

Examples:

$ ec2meta meta instance-id
$ ec2meta meta iam/info
$ ec2meta meta network/

Tags

Retrieve any instance tag by name:

$ ec2meta tag Name

User data

Retrieve the instance user data. If a path is specified, the data is treated as a JSON and searched using path as a JSON pointer.

Examples:

$ ec2meta user 
$ ec2meta meta some/custom/property

Instance identity document

Retrieve data from the instance identify document returned by http://169.254.169.254/latest/dynamic/instance-identity/document. The data to be retrieved is specified as a JSON Pointer and it’s returned, by default, as a JSON string is the value is an object, or as a raw value in all other cased. The JSON output can be forced using the -j option.

Examples:

$ ec2meta identity
$ ec2meta identify region
$ ec2meta identify instanceId

Instance data

Retrieve data from the description of the instance returned by EC2.describeInstances. The data to be retrieved is specified as a JSON Pointer and it’s returned, by default, as a JSON string is the value is an object, or as a raw value in all other cased. The JSON output can be forced using the -j option.

Examples:

$ ec2meta instance
$ ec2meta instance Placement/AvailabilityZone
$ ec2meta instance NetworkInterfaces/0/Status

Keywords

FAQs

Package last updated on 13 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc