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.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws_credentials_imds-0.4.0.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_credentials_imds-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / aws_credentials_imds-0.4.0.tar.gz
| Download URL | aws_credentials_imds-0.4.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92775c4fadbd9032b4756ff6e29e7a42d229e5b40c08efa8dedef2c3f51d8a40
|
|
BLAKE2b-256 checksum How to use checksums |
b776d63c69d462d6e78375ffe920693cfdb827ef1c425da98a8a6e385fec58ef
|
| 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.4.0-py3-none-any.whl
| Download URL | aws_credentials_imds-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76a22db825ecdc577bd24734ea803dd651da1750def321a3953c09b223adbf69
|
|
BLAKE2b-256 checksum How to use checksums |
b64326e6fe4304c38c3195793ddb21699dd0cce1f57a5d11125acb2f7dea4e17
|
| 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}
|