Skip to main content

aws-credentials-imds

This package provides an EC2 instance metadata (IMDSv2) credential resolver and chain provider.

Installation

uv pip install aws-credentials-imds

Once installed, the provider registers itself with the SDK's modular credential chain. When a client resolves credentials through the default chain, it will attempt to fetch credentials from the EC2 Instance Metadata Service when running on an EC2 instance, unless a higher-precedence source resolves credentials first.

Client Configuration

To use this resolver explicitly, set the aws_credentials_identity_resolver property on a service client's config to an IMDSCredentialsResolver instance:

from aws_credentials_imds import IMDSCredentialsResolver

service_client = ServiceClient(
    config=ServiceClientConfig(
        aws_credentials_identity_resolver=IMDSCredentialsResolver(),
    )
)

Endpoint mode, token TTL, and other options can be customized through an IMDSConfig:

from aws_credentials_imds import IMDSConfig, IMDSCredentialsResolver

resolver = IMDSCredentialsResolver(
    config=IMDSConfig(endpoint_mode="IPv6", token_ttl=300),
)

Standalone

The resolver can also be used on its own to fetch credentials directly:

import asyncio

from aws_credentials_imds import IMDSCredentialsResolver


async def main() -> None:
    resolver = IMDSCredentialsResolver()
    identity = await resolver.get_identity(properties={})


asyncio.run(main())

Metadata

Release files for aws-credentials-imds 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-credentials-imds 0.2.0
File Size Uploaded
aws_credentials_imds-0.2.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-credentials-imds 0.2.0
File Interpreter ABI Platform
aws_credentials_imds-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / aws_credentials_imds-0.2.0.tar.gz

Download URL aws_credentials_imds-0.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
202cf74130e8f6509e8e243b211e3abe5ed0ed10f47c2c355f7444ef4de144eb
BLAKE2b-256 checksum
How to use checksums
3bb3f88b82021c46ecd51655703e4be0115cf43ae27c1a87bf06ebea46b51558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / aws_credentials_imds-0.2.0-py3-none-any.whl

Download URL aws_credentials_imds-0.2.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d523042d96574d985b5394b259b73f9fc8a0ef438b430e40756e372855df2bfd
BLAKE2b-256 checksum
How to use checksums
2ce27139e3c62bddae01be5b107d71a9fe9d18ce2f39a36c563adcb1dea5be9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page