3
2

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.

[JAWS-UG CLI] Lambda:#4 エイリアスの作成

Last updated at Posted at 2015-10-26

前提条件

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

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

  1. 事前作業
    ===========

1.1. Lambda関数名の決定

コマンド
aws lambda list-functions \
        --query 'Functions[].FunctionName'
結果(例)
      [
        "HelloWorld"
      ]
変数の設定
LAMBDA_FUNC_NAME='HelloWorld'
  1. エイリアスの作成
    ===================
変数の設定
LAMBDA_ALIAS_NAME='product'
LAMBDA_FUNC_VERS='1'
LAMBDA_ALIAS_DESC='Released version on product env.'
変数の確認
cat << ETX

        LAMBDA_FUNC_NAME:   ${LAMBDA_FUNC_NAME}
        LAMBDA_ALIAS_NAME:  ${LAMBDA_ALIAS_NAME}
        LAMBDA_FUNC_VERS:   ${LAMBDA_FUNC_VERS}
        LAMBDA_ALIAS_DESC: "${LAMBDA_ALIAS_DESC}"

ETX
コマンド
aws lambda create-alias \
        --function-name ${LAMBDA_FUNC_NAME} \
        --name ${LAMBDA_ALIAS_NAME} \
        --function-version ${LAMBDA_FUNC_VERS} \
        --description "${LAMBDA_ALIAS_DESC}"
結果(例)
      {
        "AliasArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:HelloWorld:product",
        "FunctionVersion": "1",
        "Name": "product",
        "Description": "Released version on product env."
      }
  1. エイリアスの確認
    ===================
コマンド
aws lambda list-aliases \
        --function-name ${LAMBDA_FUNC_NAME}
結果(例)
      {
        "Aliases": [
          {
              "AliasArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:HelloWorld:product",
              "FunctionVersion": "1",
              "Name": "product",
              "Description": "Released version on product env."
          }
        ]
      }
コマンド
aws lambda get-alias \
        --function-name ${LAMBDA_FUNC_NAME} \
        --name ${LAMBDA_ALIAS_NAME}
結果(例)
      {
        "AliasArn": "arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:HelloWorld:product",
        "FunctionVersion": "1",
        "Name": "product",
        "Description": "Released version on product env."
      }

完了

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?