28
6

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 5 years have passed since last update.

AWS Lambda関数の環境変数の復号エラーへの対処

Posted at

背景

作成してから全然更新していないLambda関数がある日を境に呼び出しエラーになっていた。エラーメッセージはこんな感じ。

Lambda was unable to decrypt the environment variables because KMS access was denied. Please check the function’s KMS key settings. KMS Exception: AccessDeniedExceptionKMS Message: The ciphertext refers to a customer master key that does not exist, does not exist in this region, or you are not allowed to access.

暗号化された環境変数が復号できない、という内容のエラーで「KMSの設定に関してチェックしろ」と書かれている。
ググっても全然対応方法が出てこなくて、ちょっとした方法で直すことができたのでここに書いておく。

対応方法

Lambda関数の設定で、環境変数のKMSの設定を「カスタマーマスターキーの使用」から適当なキーを選んで一旦保存し、再度 aws/lambda に戻して保存し直すと動作するようになった。

それにしても、KMSの設定はデフォルト値である aws/lambda で一切変更していないはずなのに何が起こったんだろう。

28
6
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
28
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?