aws_lambda
aws_lambda · Amazon RDS for PostgreSQL extension for invoking AWS Lambda functions from SQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100959 | aws_lambda | aws_lambda | 1.0 | UTIL | Unknown | C |
PostgreSQL · 12, 13, 14, 15, 16, 17, 18
| Relationships | |
|---|---|
| Requires | aws_commons |
Usage
Sources:
aws_lambda is an Amazon RDS for PostgreSQL extension that invokes AWS Lambda functions from SQL. It is an AWS-managed, provider-only component: networking and IAM must be configured on the RDS instance before the SQL interface can work.
Core Workflow
Configure outbound HTTPS access to Lambda, attach an RDS IAM role with lambda:InvokeFunction for the permitted functions, and associate that role with the DB instance using the Lambda feature. Then connect as a user with rds_superuser privileges and install the extension with its aws_commons dependency:
Build a function identifier and make a synchronous call:
The result contains status_code, payload, executed_version, and log_result. Grant non-superusers only the SQL access they need:
Main Interface
aws_commons.create_lambda_function_arn(function_name, region)returns the composite function identifier accepted byaws_lambda.invoke.aws_lambda.invokehasjsonandjsonboverloads and accepts either a text function name/ARN or theaws_commonscomposite value.invocation_typeis case-sensitive:RequestResponsewaits for and returns the payload,Eventqueues an asynchronous invocation, andDryRunchecks access without running the function.log_type = 'Tail'returns the last 4 KB of execution log in Base64; the default isNone.contextpasses client context, whilequalifierselects a Lambda version or alias.
Configuration and Caveats
aws_lambda.connect_timeout_ms and aws_lambda.request_timeout_ms are dynamic timeout parameters. aws_lambda.endpoint_override is static and requires a database restart when changed.
AWS currently documents support for PostgreSQL 12.6+, 13.2+, 14.1+, and all RDS PostgreSQL 15–18 releases. Availability is determined by the exact RDS engine build, not by a portable community package.
SQL grants do not replace IAM authorization: the DB instance role still limits which Lambda functions can run. Private instances need NAT or a Lambda VPC endpoint; the latter also requires rds.custom_dns_resolution = 1 and a reboot. Treat payloads, returned logs, network latency, Lambda retries, and asynchronous side effects as external-service behavior rather than transactional PostgreSQL work.