Skip to content

aws.compute_optimizer.get_lambda_function_recommendations

Example SQL Queries

SELECT * FROM
aws.compute_optimizer.get_lambda_function_recommendations;

Description

Returns Lambda function recommendations.

Compute Optimizer generates recommendations for functions that meet a specific set of requirements. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide.

Table Definition

Column NameColumn Data Type
account_ids Input Column

The ID of the Amazon Web Services account for which to return function recommendations.

If your account is the management account of an organization, use this parameter to specify the member account for which you want to return function recommendations.

Only one account ID can be specified per request.

VARCHAR[]
Show child fields
account_ids[]
filters Input Column

An array of objects to specify a filter that returns a more specific list of function recommendations.

STRUCT(
"name" VARCHAR,
"values" VARCHAR[]
)[]
Show child fields
filters[]
Show child fields
filters[].name

The name of the filter.

Specify Finding to return recommendations with a specific finding classification (for example, NotOptimized).

Specify FindingReasonCode to return recommendations with a specific finding reason code (for example, MemoryUnderprovisioned).

You can filter your Lambda function recommendations by tag:key and tag-key tags.

A tag:key is a key and value combination of a tag assigned to your Lambda function recommendations. Use the tag key in the filter name and the tag value as the filter value. For example, to find all Lambda function recommendations that have a tag with the key of Owner and the value of TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

A tag-key is the key of a tag assigned to your Lambda function recommendations. Use this filter to find all of your Lambda function recommendations that have a tag with a specific key. This doesn’t consider the tag value. For example, you can find your Lambda function recommendations with a tag key value of Owner or without any tag keys assigned.

filters[].values[]
function_arns Input Column

The Amazon Resource Name (ARN) of the functions for which to return recommendations.

You can specify a qualified or unqualified ARN. If you specify an unqualified ARN without a function version suffix, Compute Optimizer will return recommendations for the latest ($LATEST) version of the function. If you specify a qualified ARN with a version suffix, Compute Optimizer will return recommendations for the specified function version. For more information about using function versions, see Using versions in the Lambda Developer Guide.

VARCHAR[]
Show child fields
function_arns[]
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
account_id

The Amazon Web Services account ID of the function.

VARCHAR
current_memory_size

The amount of memory, in MB, that's allocated to the current function.

BIGINT
current_performance_risk

The risk of the current Lambda function not meeting the performance needs of its workloads. The higher the risk, the more likely the current Lambda function requires more memory.

VARCHAR
effective_recommendation_preferences

Describes the effective recommendation preferences for Lambda functions.

STRUCT(
"savings_estimation_mode" STRUCT(
"source" VARCHAR
)
)
Show child fields
effective_recommendation_preferences.savings_estimation_mode

Describes the savings estimation mode applied for calculating savings opportunity for Lambda functions.

Show child fields
effective_recommendation_preferences.savings_estimation_mode.source

Describes the source for calculation of savings opportunity for Lambda functions.

finding

The finding classification of the function.

Findings for functions include:

  • Optimized — The function is correctly provisioned to run your workload based on its current configuration and its utilization history. This finding classification does not include finding reason codes.

  • NotOptimized — The function is performing at a higher level (over-provisioned) or at a lower level (under-provisioned) than required for your workload because its current configuration is not optimal. Over-provisioned resources might lead to unnecessary infrastructure cost, and under-provisioned resources might lead to poor application performance. This finding classification can include the MemoryUnderprovisioned and MemoryUnderprovisioned finding reason codes.

  • Unavailable — Compute Optimizer was unable to generate a recommendation for the function. This could be because the function has not accumulated sufficient metric data, or the function does not qualify for a recommendation. This finding classification can include the InsufficientData and Inconclusive finding reason codes.

    Functions with a finding of unavailable are not returned unless you specify the filter parameter with a value of Unavailable in your GetLambdaFunctionRecommendations request.

VARCHAR
finding_reason_codes

The reason for the finding classification of the function.

Functions that have a finding classification of Optimized don't have a finding reason code.

Finding reason codes for functions include:

  • MemoryOverprovisioned — The function is over-provisioned when its memory configuration can be sized down while still meeting the performance requirements of your workload. An over-provisioned function might lead to unnecessary infrastructure cost. This finding reason code is part of the NotOptimized finding classification.

  • MemoryUnderprovisioned — The function is under-provisioned when its memory configuration doesn't meet the performance requirements of the workload. An under-provisioned function might lead to poor application performance. This finding reason code is part of the NotOptimized finding classification.

  • InsufficientData — The function does not have sufficient metric data for Compute Optimizer to generate a recommendation. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide. This finding reason code is part of the Unavailable finding classification.

  • Inconclusive — The function does not qualify for a recommendation because Compute Optimizer cannot generate a recommendation with a high degree of confidence. This finding reason code is part of the Unavailable finding classification.

VARCHAR[]
Show child fields
finding_reason_codes[]
function_arn

The Amazon Resource Name (ARN) of the current function.

VARCHAR
function_version

The version number of the current function.

VARCHAR
last_refresh_timestamp

The timestamp of when the function recommendation was last generated.

TIMESTAMP_S
lookback_period_in_days

The number of days for which utilization metrics were analyzed for the function.

DOUBLE
memory_size_recommendation_options

An array of objects that describe the memory configuration recommendation options for the function.

STRUCT(
"rank" BIGINT,
"memory_size" BIGINT,
"projected_utilization_metrics" STRUCT(
"name" VARCHAR,
"statistic" VARCHAR,
"value" DOUBLE
)[],
"savings_opportunity" STRUCT(
"savings_opportunity_percentage" DOUBLE,
"estimated_monthly_savings" STRUCT(
"currency" VARCHAR,
"value" DOUBLE
)
),
"savings_opportunity_after_discounts" STRUCT(
"savings_opportunity_percentage" DOUBLE,
"estimated_monthly_savings" STRUCT(
"currency" VARCHAR,
"value" DOUBLE
)
)
)[]
Show child fields
memory_size_recommendation_options[]
Show child fields
memory_size_recommendation_options[].memory_size

The memory size, in MB, of the function recommendation option.

memory_size_recommendation_options[].projected_utilization_metrics[]
Show child fields
memory_size_recommendation_options[].projected_utilization_metrics[].name

The name of the projected utilization metric.

memory_size_recommendation_options[].projected_utilization_metrics[].statistic

The statistic of the projected utilization metric.

memory_size_recommendation_options[].projected_utilization_metrics[].value

The values of the projected utilization metrics.

memory_size_recommendation_options[].rank

The rank of the function recommendation option.

The top recommendation option is ranked as 1.

memory_size_recommendation_options[].savings_opportunity

An object that describes the savings opportunity for the Lambda function recommendation option. Savings opportunity includes the estimated monthly savings amount and percentage.

Show child fields
memory_size_recommendation_options[].savings_opportunity.estimated_monthly_savings

An object that describes the estimated monthly savings amount possible by adopting Compute Optimizer recommendations for a given resource. This is based on the On-Demand instance pricing..

Show child fields
memory_size_recommendation_options[].savings_opportunity.estimated_monthly_savings.currency

The currency of the estimated monthly savings.

memory_size_recommendation_options[].savings_opportunity.estimated_monthly_savings.value

The value of the estimated monthly savings.

memory_size_recommendation_options[].savings_opportunity.savings_opportunity_percentage

The estimated monthly savings possible as a percentage of monthly cost by adopting Compute Optimizer recommendations for a given resource.

memory_size_recommendation_options[].savings_opportunity_after_discounts

An object that describes the savings opportunity for the Lambda recommendation option which includes Saving Plans discounts. Savings opportunity includes the estimated monthly savings and percentage.

Show child fields
memory_size_recommendation_options[].savings_opportunity_after_discounts.estimated_monthly_savings

The estimated monthly savings possible by adopting Compute Optimizer’s Lambda function recommendations. This includes any applicable Savings Plans discounts.

Show child fields
memory_size_recommendation_options[].savings_opportunity_after_discounts.estimated_monthly_savings.currency

The currency of the estimated monthly savings.

memory_size_recommendation_options[].savings_opportunity_after_discounts.estimated_monthly_savings.value

The value of the estimated monthly savings.

memory_size_recommendation_options[].savings_opportunity_after_discounts.savings_opportunity_percentage

The estimated monthly savings possible as a percentage of monthly cost by adopting Compute Optimizer’s Lambda function recommendations. This includes any applicable Savings Plans discounts.

number_of_invocations

The number of times your function code was applied during the look-back period.

BIGINT
tags

A list of tags assigned to your Lambda function recommendations.

STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
Show child fields
tags[]
Show child fields
tags[].key

One part of a key-value pair that makes up a tag. A key is a general label that acts like a category for more specific tag values.

tags[].value

One part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.

utilization_metrics

An array of objects that describe the utilization metrics of the function.

STRUCT(
"name" VARCHAR,
"statistic" VARCHAR,
"value" DOUBLE
)[]
Show child fields
utilization_metrics[]
Show child fields
utilization_metrics[].name

The name of the utilization metric.

The following utilization metrics are available:

  • Duration - The amount of time that your function code spends processing an event.

  • Memory - The amount of memory used per invocation.

utilization_metrics[].statistic

The statistic of the utilization metric.

The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the Maximum statistic, which is the highest value observed during the specified period.

The Compute Optimizer console displays graphs for some utilization metrics using the Average statistic, which is the value of Sum/SampleCount during the specified period. For more information, see Viewing resource recommendations in the Compute Optimizer User Guide. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the Amazon CloudWatch User Guide.

utilization_metrics[].value

The value of the utilization metric.