{"categories":[{"label":"Monitoring","url":"https://skillfed.io/packages/category/system-monitoring/2"}],"enrichment":{"capability":"Queries the EC2 Instance Metadata Service v2 to retrieve instance configuration data (region, instance ID, IAM credentials, availability zone, and similar) with built-in caching.","skillfed_tags":["aws-ec2","metadata-service","instance-discovery"],"use_cases":["Retrieve the current EC2 instance's region or availability zone at runtime for region-aware application logic.","Fetch temporary IAM security credentials from instance metadata for AWS API calls without managing long-lived keys.","Determine instance identity and configuration (instance type, AMI ID, account ID) for logging, monitoring, or auto-discovery.","Build Docker containers on EC2 that need to query instance metadata without adding boto3 as a dependency.","Implement health checks or lifecycle hooks that read uncached metadata like instance_action or autoscaling target state."],"what_it_does":"ec2-metadata is a Python library that provides a clean interface to the AWS EC2 Instance Metadata Service v2 (IMDSv2), which is more secure against SSRF attacks than the older v1 service. It wraps urllib3 to handle HTTP requests to the metadata endpoint and caches most attributes on first access, since EC2 instance metadata is largely immutable without stopping the instance.\n\nThe library exposes a singleton instance (ec2_metadata) with attributes like region, instance_id, availability_zone, iam_security_credentials, and account_id. Most attributes are cached using functools.cached_property and can be cleared individually or all at once. It handles IMDSv2's token-based authentication automatically and is designed as a lightweight alternative to boto3 for applications that only need metadata, not the full AWS SDK.","worth_installing":"Yes. This is a stable, actively maintained library with no known vulnerabilities, low install friction, and a permissive MIT license. It solves a real gap left by boto3's lack of a metadata utility. Install it if you're running on EC2 and need to query instance metadata without pulling in the full AWS SDK."},"id":"ec2-metadata","links":{"html":"https://skillfed.io/packages/ec2-metadata","md":"https://skillfed.io/packages/ec2-metadata.md","pypi":"https://pypi.org/project/ec2-metadata/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-02-11","license_spdx":"MIT","license_treatment":"permissive","name":"ec2-metadata","python_support":"supports_current","summary":"An easy interface to query the EC2 metadata API, with caching."},"popularity":{"monthly_downloads":2355170,"position":3111,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"3.0.0"}
