feat: support AWS_REGION environment variable for region configuration #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Under the current specification, setting the AWS_REGION environment variable and running agentcore launch results in an error because the region is not properly configured.
The reason AWS_REGION is not being read is that boto3 irregularly reads the AWS_DEFAULT_REGION environment variable instead. The status of environment variables for other CLIs and SDKs is summarized in the following link:
https://stackoverflow.com/questions/59961939/what-is-the-difference-between-aws-default-region-and-aws-region-system-variable
I believe we should align with the AWS standard specification rather than boto3's specific behavior. Therefore, I've made changes so that when AWS_REGION is set, agentcore launch will execute in that specified region.
This change is categorized as a breaking change because if AWS_REGION is unintentionally set, agentcore launch might execute in an unintended region. However, I believe such cases would be rare.
Type of Change
Testing
Checklist
Security Checklist
Breaking Changes
List any breaking changes and migration instructions:
If unintended deployment to a different region occurs due to AWS_REGION, you will need to either remove or override the AWS_REGION environment variable. AWS_DEFAULT_REGION remains available for use, but AWS_REGION takes higher precedence.
Additional Notes
N/A