Metadata-Version: 2.5
Name: aws-credentials-imds
Version: 0.1.0
Summary: EC2 Instance Metadata Service credentials support for the AWS SDK for Python.
Project-URL: Code, https://github.com/aws/aws-sdk-python/tree/develop/packages/aws-credentials-imds/
Project-URL: Issue tracker, https://github.com/aws/aws-sdk-python/issues
Author: Amazon Web Services
License: Apache License 2.0
License-File: NOTICE
Keywords: aws,credentials,ec2,imds,sdk,smithy
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: smithy-aws-core~=0.9.0
Requires-Dist: smithy-core~=0.8.0
Requires-Dist: smithy-http[aiohttp]~=0.4.0
Description-Content-Type: text/markdown

# aws-credentials-imds

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

## Installation

```shell
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:

```python
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`:

```python
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:

```python
import asyncio

from aws_credentials_imds import IMDSCredentialsResolver

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

asyncio.run(main())
```
