Skip to content

Add environment variable support for AWS profiles and regions#297

Merged
samuhale merged 1 commit intoaws:masterfrom
oyiz-michael:feature/aws-env-var-support
Jul 29, 2025
Merged

Add environment variable support for AWS profiles and regions#297
samuhale merged 1 commit intoaws:masterfrom
oyiz-michael:feature/aws-env-var-support

Conversation

@oyiz-michael
Copy link
Copy Markdown
Contributor

Implements support for standard AWS environment variables:

  • AWS_PROFILE for specifying AWS profile
  • AWS_REGION and AWS_DEFAULT_REGION for specifying region

This addresses GitHub issues:

Changes:

  • Modified get_aws_profile() to check AWS_PROFILE environment variable
  • Modified get_target_region() to check AWS_REGION and AWS_DEFAULT_REGION
  • Added comprehensive test coverage for environment variable functionality
  • Updated README with documentation and examples
  • Maintains backward compatibility with existing behavior

The implementation follows standard AWS CLI precedence:

  1. Mount options take highest precedence
  2. Environment variables are checked next
  3. Config files and instance metadata are fallbacks

This improves usability in containerized environments, CI/CD pipelines, and other automated deployment scenarios.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Implements support for standard AWS environment variables:
- AWS_PROFILE for specifying AWS profile
- AWS_REGION and AWS_DEFAULT_REGION for specifying region

This addresses GitHub issues:
- aws#278: AWS Profiles – support for standard environment variables
- aws#166: Support setting region as env var and/or mount option

Changes:
- Modified get_aws_profile() to check AWS_PROFILE environment variable
- Modified get_target_region() to check AWS_REGION and AWS_DEFAULT_REGION
- Added comprehensive test coverage for environment variable functionality
- Updated README with documentation and examples
- Maintains backward compatibility with existing behavior

The implementation follows standard AWS CLI precedence:
1. Mount options take highest precedence
2. Environment variables are checked next
3. Config files and instance metadata are fallbacks

This improves usability in containerized environments, CI/CD pipelines,
and other automated deployment scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants