Skip to content

Allow using the endpoint with environment variables #7198

@skyrpex

Description

@skyrpex

Describe the feature

Allow specifying the endpoint with environment variables such as AWS_ENDPOINT (global), AWS_ENDPOINT_S3, etc.

Use Case

Configuring credentials via environment variables is handy for various environments, especially development. However, endpoints can’t be configured this way, so specific code must be written to support customizing endpoints.

Would be useful being able to define AWS_ENDPOINT=http://localhost:4566 in an .env.local file, along with fake credentials, and have a working dev environment with LocalStack.

The AWS CLI can also be configured this way.

Also, some packages do instantiate clients directly (without ability to pass options), trusting users can leverage env vars to customize the clients.

Proposed Solution

Add a new endpointProvider property to clients for custom endpoint retrieval. Default to fromEnv with a fallback to the current behavior.

Ideally, the endpoint provider receives a service identifier to consume specific environment variables per client type (e.g., S3Client reads AWS_ENDPOINT_S3 first).

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

3

Environment details (OS name and version, etc.)

osx

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or enhancement. May require GitHub community feedback.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions