Help us understand the problem. What is going on with this article?

[JAWS-UG CLI] Lambda:#2 Lambda関数設定の変更

More than 5 years have passed since last update.

前提条件

Lambdaへの権限

Lambdaに対してフル権限があること。

AWS CLI

以下のバージョンで動作確認済

  • AWS CLI 1.9.0
コマンド
aws --version
結果(例)
      aws-cli/1.9.0 Python/2.7.5 Darwin/13.4.0 botocore/1.3.0

0. 準備

0.1. 変数の確認

プロファイルが想定のものになっていることを確認します。

変数の確認
aws configure list
結果(例)
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile       administrator-prjz-mbp13        env    AWS_DEFAULT_PROFILE
      access_key     ****************XXXX shared-credentials-file
      secret_key     ****************XXXX shared-credentials-file
          region                ap-northeast-1        env    AWS_DEFAULT_REGION

0.2. Lambda関数名の決定

コマンド
aws lambda list-functions \
        --query 'Functions[].FunctionName'
結果(例)
      [
        "HelloWorld"
      ]
変数の設定
LAMBDA_FUNC_NAME='HelloWorld'

1. 事前作業

1.1. Lambda関数の設定確認

コマンド
aws lambda get-function-configuration \
        --function-name ${LAMBDA_FUNC_NAME}
結果(例)
      {
        "CodeSha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
        "FunctionName": "HelloWorld",
        "CodeSize": 350,
        "MemorySize": 128,
        "FunctionArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:HelloWorld",
        "Version": "$LATEST",
        "Role": "arn:aws:iam::XXXXXXXXXXXX:role/lambdaBasicExecution",
        "Timeout": 3,
        "LastModified": "2015-10-26T01:23:45.678+0000",
        "Handler": "HelloWorld.handler",
        "Runtime": "nodejs",
        "Description": "A starter AWS Lambda function."
      }

1.2. Lambda関数のディスクリプション確認

コマンド
aws lambda get-function-configuration \
        --function-name ${LAMBDA_FUNC_NAME} \
        --query 'Description' \
        --output text
結果(例)
      A starter AWS Lambda function.

2. Lambda関数の設定変更

変数の設定
LAMBDA_FUNC_DESC='Hello World with AWS Lambda function.'
変数の確認
cat << ETX

        LAMBDA_FUNC_NAME:  ${LAMBDA_FUNC_NAME}
        LAMBDA_FUNC_DESC: "${LAMBDA_FUNC_DESC}"

ETX
コマンド
aws lambda update-function-configuration \
        --function-name ${LAMBDA_FUNC_NAME} \
        --description "${LAMBDA_FUNC_DESC}"
結果(例)
      {
        "CodeSha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
        "FunctionName": "HelloWorld",
        "CodeSize": 350,
        "MemorySize": 128,
        "FunctionArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:HelloWorld",
        "Version": "$LATEST",
        "Role": "arn:aws:iam::XXXXXXXXXXXX:role/lambdaBasicExecution",
        "Timeout": 3,
        "LastModified": "2015-10-26T03:08:28.302+0000",
        "Handler": "HelloWorld.handler",
        "Runtime": "nodejs",
        "Description": "Hello World with AWS Lambda function."
      }

3. Lambda関数の設定確認

コマンド
aws lambda get-function-configuration \
        --function-name ${LAMBDA_FUNC_NAME} \
        --query 'Description' \
        --output text
結果(例)
      Hello World with AWS Lambda function.

完了

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away