Skip to main content

Allows querying EC2 instance metadata

Project description

EC2 Instance Metadata

This allows querying EC2 instance metadata.

It uses IMDSv2. Session credentials are NOT available using this.

Installation

Available on Pypi as query-ec2-metadata

pip install query-ec2-metadata

Command line tools

ec2-metadata

Usage: ec2-metadata KEY

This returns an attribute from the instance metadata.

The KEY can be any of the data values from https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html

instance-identity

Usage: instance-identity KEY

This returns an attribute from the instance identity document.

The key can be any of the data values from https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html

Python module

instance_identity_document() -> Dict[str, str]:

This returns the identity document for the instance.

instance_identity(key: str) -> str:

This returns an attribute from the instance identity document.

The key can be any of the data values from https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html

ec2_metadata(key: str) -> str:

This returns an attribute from the instance metadata.

The key can be any of the data values from https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html

Development

  • make init to set things up
  • make pytest to run unit tests
  • make test to run all tests

Remember to bump the version in pyproject.toml before merging.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

query_ec2_metadata-0.1.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

query_ec2_metadata-0.1.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file query_ec2_metadata-0.1.3.tar.gz.

File metadata

  • Download URL: query_ec2_metadata-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.6.9 Linux/5.4.0-1047-aws

File hashes

Hashes for query_ec2_metadata-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d85a324ee78bd7fefba63617c11bb7c34aa96da548d6d13541f938deb6d3daf3
MD5 ee84540ee390985043b5aa12d2bb7f34
BLAKE2b-256 54b8789c5c7a8fc839131501490046b9edeb7ee715651fb14ba597ba99f04099

See more details on using hashes here.

File details

Details for the file query_ec2_metadata-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for query_ec2_metadata-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 71440823935ccc79f422b48459a503a69ded57f9bcea463fa42b7c6f91471bdc
MD5 374a440a9fff9bffbdc66772e504e687
BLAKE2b-256 9d46ab638ff50cd08e1c55d39936415cdfd353cdc470f38ab0ad130ca4bb23f1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page