serverless/serverless

Support for AWS_DEFAULT_REGION and "region" in "~/.aws/config"

Open

#2,151 创建于 2016年9月16日

在 GitHub 查看
 (11 评论) (6 反应) (0 负责人)JavaScript (46,915 star) (5,734 fork)batch import
bug/designcat/dxdeprecationenhancementhelp wanted

描述

Updated at 2020-07-22 by @medikoo:

Framework resolves region as follows:

  • If region was set via --region CLI 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_REGION env 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_REGION env and AWS profile, and if there's region resolved from it and it doesn't match us-east-1 show 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

贡献者指南