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?

AWS Lambda(Python) ランタイム、レイヤー更新 AWS CLIメモ

0
Posted at

複数のLambdaに対して、Pythonのランタイムを3.8->3.13、レイヤー更新を行ったメモ

AWSコンソールからランタイムとレイヤー更新は可能ですが、
更新対象のLambdaが複数あると手間がかかる為、AWS CLIで対応しました。

AWS CLI

aws lambda update-function-configuration \ 
    --function-name ここに関数名 \ 
    --runtime python3.13 \ 
    --layers \ 
        arn:aws:lambda:ap-northeast-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python313-x86_64:\ 
        arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:83 

※layersオプションは入れたいレイヤーのarnを指定してください。

以下、Lambdaにデフォルトで入れているレイヤー

AWSLambdaPowertoolsPython

AWS公式のレイヤー。CloudWatch logの記録に使用しています。

Python3.13は「AWSLambdaPowertoolsPythonV3」を使用。(Python3.8では「AWSLambdaPowertoolsPython」だった)
https://docs.powertools.aws.dev/lambda/python/3.13.0/
arn → arn:aws:lambda:ap-northeast-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python313-x86_64:7

LambdaInsightsExtension

AWS公式のレイヤー。CPU使用率、メモリ使用率を確認したい場合に使用します。
API Gateway経由でメイン処理をLambdaで担当させており、負荷の確認を行いたいため入れています。
大抵の軽い処理を行うLambdaなら不要だと思いますが、有効にしたい場合はAWSコンソールのLambda設定画面から可能です。

今回の3.13の対応では最新のバージョン83にアップデートします。
https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versionsx86-64.html
arn → arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:83

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?