0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[AWS SAM] 環境変数に AWS_DEFAULT_REGION を設定しようとしてエラー発生

Posted at

エラーメッセージ

Resource handler returned message: "Lambda was unable to configure your environment variables because the environment variables you have provided contains reserved keys that are currently not supported for modification. Reserved keys used in this request: AWS_DEFAULT_REGION (Service: Lambda, Status Code: 400, ... , HandlerErrorCode: InvalidRequest)

AWS_DEFAULT_REGIONという環境変数は、予約済み(reserved)なので、現在は書き換えられないよ。」と仰っている。

問題の箇所

template.yaml
...

Globals:
  Function:
    Timeout: 3
    MemorySize: 256
    Tracing: Active
    Environment:
      Variables:
        AWS_DEFAULT_REGION: us-east-1  # <-- ココ
  Api:
    TracingEnabled: True

...

人によって記載箇所は違うと思うが、

    Environment:
      Variables:
        AWS_DEFAULT_REGION: ~~~~~

という記載がどこかにあれば、冒頭に記載したエラーが発生すると思われる。

対処

以下の記事を見てわかったのだけど、AWS_DEFAULT_REGIONは、自分でわざわざ設定しなくても自動でAWSが設定してくれる。

なので、

    Environment:
      Variables:
        AWS_DEFAULT_REGION: ~~~~~

は削除してOK(´^ω^`)気付かなかった

関連記事

本記事と、ちょっと似てる話。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?