serverless/serverless
在 GitHub 查看Support for AWS_DEFAULT_REGION and "region" in "~/.aws/config"
Open
#2,151 创建于 2016年9月16日
bug/designcat/dxdeprecationenhancementhelp wanted
描述
Updated at 2020-07-22 by @medikoo:
Framework resolves region as follows:
- If region was set via
--regionCLI param, use it - If region was set in service configuration, use it
- Fallback to
us-east-1
Ideally instead of falling back to us-east-1, we should follow same resolution as they happen in AWS CLI, which is:
- Support
AWS_DEFAULT_REGIONenv variable - Support region as configured for use AWS profile
Only if region was not resolved with above steps, fallback to us-east-1.
Adding support for that currently should be considered a breaking change (as e.g. for current deployment existence of AWS_DEFAULT_REGION may change the region to which usually service was deployed)
Therefore I believe implementation should be done in two phases:
- Add resolution from
AWS_DEFAULT_REGIONenv and AWS profile, and if there's region resolved from it and it doesn't matchus-east-1show a deprecation notice: Resolution of AWS region will change with next release. To ensure consistency when upgrade, configure region in service config or pass it via CLI option. - With release of v2, simply fallback to region as resolved from above means.
Similar or dependent issues:
- #2147
- #2078
- #1707