Movatterモバイル変換


[0]ホーム

URL:


Retrieve data about Lambda functions that use a deprecated runtime - AWS Lambda
DocumentationAWS LambdaDeveloper Guide
Listing function versions that use a particular runtimeIdentifying most commonly and most recently invoked functions

Retrieve data about Lambda functions that use a deprecated runtime

When a Lambda runtime is approaching deprecation, Lambda alerts you through email and provides notifications in the AWS Health Dashboard and Trusted Advisor. These emails and notifications list the $LATEST versions of functions using the runtime. To list all of your function versions that use a particular runtime, you can use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs.

If you have a large number of functions which use a runtime that is due to be deprecated, you can also use the AWS CLI or AWS SDKs to help you prioritize updates to your most commonly invoked functions.

Refer to the following sections to learn how to use the AWS CLI and AWS SDKs to gather data about functions that use a particular runtime.

Listing function versions that use a particular runtime

To use the AWS CLI to list all of your function versions that use a particular runtime, run the following command. ReplaceRUNTIME_IDENTIFIER with the name of the runtime that’s being deprecated and choose your own AWS Region. To list only $LATEST function versions, omit--function-version ALL from the command.

aws lambda list-functions --function-version ALL --regionus-east-1 --output text --query "Functions[?Runtime=='RUNTIME_IDENTIFIER'].FunctionArn"

You can also list functions that use a particular runtime using one of the AWS SDKs. The following example code uses the V3 AWS SDK for JavaScript and the AWS SDK for Python (Boto3) to return a list of the function ARNs for functions using a particular runtime. The example code also returns the CloudWatch log group for each of the listed functions. You can use this log group to find the last invocation date for the function. See the following sectionIdentifying most commonly and most recently invoked functions for more information.

Node.js
Example JavaScript code to list functions using a particular runtime
Python
Example Python code to list functions using a particular runtime

To learn more about using an AWS SDK to list your functions using theListFunctions action, see theSDK documentation for your preferred programming language.

You can also use the AWS Config Advanced queries feature to list all your functions that use an affected runtime. This query only returns function $LATEST versions, but you can aggregate queries to list function across all regions and multiple AWS accounts with a single command. To learn more, seeQuerying the Current Configuration State of AWS Auto Scaling Resources in theAWS Config Developer Guide.

Identifying most commonly and most recently invoked functions

If your AWS account contains functions that use a runtime that's due to be deprecated, you might want to prioritize updating functions that are frequently invoked or functions that have been invoked recently.

If you have only a few functions, you can use the CloudWatch Logs console to gather this information by looking at your functions' log streams. SeeView log data sent to CloudWatch Logs for more information.

To see the number of recent function invocations, you can also use the CloudWatch metrics information shown in the Lambda console. To view this information, do the following:

  1. Open theFunctions page of the Lambda console.

  2. Select the function you want to see invocation statistics for.

  3. Choose theMonitor tab.

  4. Set the time period you wish to view statistics for using the date range picker. Recent invocations are displayed in theInvocations pane.

For accounts with larger numbers of functions, it can be more efficient to gather this data programmatically using the AWS CLI or one of the AWS SDKs using theDescribeLogStreams andGetMetricStatistics API actions.

The following examples provide code snippets using the V3 AWS SDK for JavaScript and the AWS SDK for Python (Boto3) to identify the last invoke date for a particular function and to determine the number of invocations for a particular function in the last 14 days.

Node.js
Example JavaScript code to find last invocation time for a function
Python
Node.js
Python
Permissions
Runtime modifications

[8]
ページ先頭

©2009-2025 Movatter.jp