Skip to main content
selectAWSlast verified 2026-07-29
Serviceslambda
CredentialsAWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
Permissionslambda:ListFunctions
Fan-out: region - one call per region when swept across regions. One list call per region when swept account-wide

Lambda fleet analytics by runtime and architecture

Profiles a region's Lambda fleet by runtime and architecture. This is the view behind two recurring programmes of work: runtime modernisation, where functions on runtimes past their deprecation date stop receiving security patches and eventually cannot be updated, and Graviton migration, where moving x86_64 functions to arm64 cuts cost at equivalent performance.

Query

SELECT
runtime,
architecture,
count(*) as function_count,
sum(memory_size) as total_memory_mb,
avg(memory_size) as avg_memory_mb,
max(timeout) as max_timeout_seconds
FROM (
SELECT
runtime,
json_extract(architectures, '$[0]') as architecture,
memory_size + 0 as memory_size,
timeout + 0 as timeout
FROM aws.lambda.functions
WHERE region = '{{region}}'
) t
GROUP BY runtime, architecture
ORDER BY count(*) DESC;

Variation: architecture split only

The Graviton migration view - how much of the fleet is still on x86_64:

SELECT
architecture,
count(*) as function_count,
sum(memory_size) as total_memory_mb
FROM (
SELECT
json_extract(architectures, '$[0]') as architecture,
memory_size + 0 as memory_size
FROM aws.lambda.functions
WHERE region = '{{region}}'
) t
GROUP BY architecture;

Notes

The aggregation runs client-side over the list response, so it costs one API call regardless of fleet size. The numeric columns need the + 0 coercion in the subquery: memory_size and timeout arrive as text, and without it sum and avg produce zero and comparisons order lexicographically. ORDER BY must repeat the aggregate expression rather than reference its alias - ORDER BY count(*) DESC works where ORDER BY function_count DESC fails with a no such column error. Check the runtime values returned against the AWS Lambda runtime deprecation calendar rather than a hardcoded list - deprecation dates move and each runtime retires on its own schedule. A null runtime with package_type Image is a container image function, which is not subject to managed runtime deprecation but carries its own base image patching obligation. Rank remediation by function_count, then by total_memory_mb as a rough proxy for spend.

Related queries