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())

Download files

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

Source Distribution

aws_credentials_imds-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_credentials_imds-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file aws_credentials_imds-0.1.0.tar.gz.

File metadata

  • Download URL: aws_credentials_imds-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for aws_credentials_imds-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b524802a18f5ce3e4446737b623588b146a3bdb818cc2a9bce5b6ece595dc677
MD5 696f1d554f8e1de74413e49b00c59e4b
BLAKE2b-256 e1855425c34cb973d104c683bc0f4b5068bec75f5e9b31d0a20c9415740ad77c

See more details on using hashes here.

File details

Details for the file aws_credentials_imds-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aws_credentials_imds-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for aws_credentials_imds-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 651c8e80063637bc1dbf72238d84b9fd84652562ab9ef8bc502ae2132793c90a
MD5 e3a8671dbaed959249f341cb65530217
BLAKE2b-256 eebce2591f1cdb5b566be49e9f370fa958571a6e1c79e135fb9c4530f6b35838

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page