LoginSignup
7
1

More than 3 years have passed since last update.

【AWS lambda】update-function-configurationしようとして謎のエラーに焦った話

Last updated at Posted at 2019-10-04

環境変数を指定しようとして

$ aws lambda update-function-configuration --function-name <関数名> --environment Variables={Key1=value1,Key2=Value2}

このコマンドを使おうとしたら、次のエラーが。

Unknown options : Variables=Key2=Value2

aws cliでは複数の環境変数の設定ができないのか....!!
と焦ったのですが、試行錯誤の末いくつかの解決策が。

解決策1

カンマの利用
ってか、カンマが正しく認識されていない.....???
そこでカンマの前にバックスラッシュを入れたらエラーが出ずに通りました。

ちなみに、macで「(バックスラッシュ)」の出し方は、「Option」+「¥」です。

$ aws lambda update-function-configuration --function-name <関数名> --environment Variables={"Key1"="value1"\,"Key2"="Value2"}

解決策2

シングルクウォートの利用
中括弧全体をシングルクウォートでくくると、なんでかわかんないけど大丈夫だった!

$ aws lambda update-function-configuration --function-name <関数名> --environment Variables='{Key1="value1",Key2="Value2"}'
7
1
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
7
1