functions
Creates, updates, deletes, gets or lists a functions resource.
Overview
| Name | functions |
| Type | Resource |
| Id | aws.lambda.functions |
Fields
The following fields are returned by SELECT queries:
- get_function
- list_functions
| Name | Datatype | Description |
|---|---|---|
code | object | The deployment package of the function or version. |
concurrency | object | The function's reserved concurrency. |
configuration | object | Details about a function's configuration. |
tags | object | The function's tags. Lambda returns tag data only if you have explicit allow permissions for lambda:ListTags. |
tags_error | object | An object that contains details about an error related to retrieving tags. |
| Name | Datatype | Description |
|---|---|---|
architectures | array | The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64. |
capacity_provider_config | object | Configuration for the capacity provider that manages compute resources for Lambda functions. |
code_sha_256 | string | The SHA256 hash of the function's deployment package. |
code_size | integer (int64) | The size of the function's deployment package, in bytes. |
config_sha_256 | string | The SHA256 hash of the function configuration. |
dead_letter_config | object | The dead-letter queue for failed asynchronous invocations. |
description | string | The function's description. |
durable_config | object | Configuration settings for durable functions, including execution timeout, retention period for execution history, and an optional ARN of the Key Management Service (KMS) customer managed key that is used to encrypt your durable execution's payload data, including input, output, and error payloads. |
environment | object | The function's environment variables. Omitted from CloudTrail logs. |
ephemeral_storage | object | The size of the function's /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB. For more information, see Configuring ephemeral storage (console). |
file_system_configs | array | Connection settings for an Amazon EFS file system or an Amazon S3 Files file system. |
function_arn | string | The function's Amazon Resource Name (ARN). (pattern: <code>arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-.]+(:($LATEST(.PUBLISHED)?|[a-zA-Z0-9-]+))?</code>) |
function_name | string | The name of the function. (pattern: <code>(arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:|(((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:)?(\d{12}:)?))(function:)?([a-zA-Z0-9-.]+)(:($LATEST(.PUBLISHED)?|[a-zA-Z0-9-]+))?</code>) |
handler | string | The function that Lambda calls to begin running your function. (pattern: <code>[^\s]+</code>) |
image_config_response | object | The function's image configuration values. |
kms_key_arn | string | The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt the following resources: The function's environment variables. The function's Lambda SnapStart snapshots. When used with SourceKMSKeyArn, the unzipped version of the .zip deployment package that's used for function invocations. For more information, see Specifying a customer managed key for Lambda. The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see Function lifecycle. If you don't provide a customer managed key, Lambda uses an Amazon Web Services owned key or an Amazon Web Services managed key. (pattern: <code>(arn:(aws[a-zA-Z-])?:[a-z0-9-.]+:.)|()</code>) |
last_modified | string | The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD). (pattern: <code>.*</code>) |
last_update_status | string | The status of the last update that was performed on the function. This is first set to Successful after function creation completes. (Successful, Failed, InProgress) |
last_update_status_reason | string | The reason for the last update that was performed on the function. |
last_update_status_reason_code | string | The reason code for the last update that was performed on the function. (EniLimitExceeded, InsufficientRolePermissions, InvalidConfiguration, InternalError, SubnetOutOfIPAddresses, InvalidSubnet, InvalidSecurityGroup, ImageDeleted, ImageAccessDenied, InvalidImage, KMSKeyAccessDenied, KMSKeyNotFound, InvalidStateKMSKey, DisabledKMSKey, EFSIOError, EFSMountConnectivityError, EFSMountFailure, EFSMountTimeout, InvalidRuntime, InvalidZipFileException, FunctionError, ServiceQuotaExceededException, VcpuLimitExceeded, CapacityProviderScalingLimitExceeded, InsufficientCapacity, EC2RequestLimitExceeded, FunctionError.InitTimeout, FunctionError.RuntimeInitError, FunctionError.ExtensionInitError, FunctionError.InvalidEntryPoint, FunctionError.InvalidWorkingDirectory, FunctionError.PermissionDenied, FunctionError.TooManyExtensions, FunctionError.InitResourceExhausted, DisallowedByVpcEncryptionControl, DependencyError) |
layers | array | The function's layers. |
logging_config | object | The function's Amazon CloudWatch Logs configuration settings. |
master_arn | string | For Lambda@Edge functions, the ARN of the main function. (pattern: <code>arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-]+(:($LATEST|[a-zA-Z0-9-]+))?</code>) |
memory_size | integer | The amount of memory available to the function at runtime. |
package_type | string | The type of deployment package. Set to Image for container image and set Zip for .zip file archive. (Zip, Image) |
revision_id | string | The latest updated revision of the function or alias. |
role | string | The function's execution role. (pattern: <code>arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+</code>) |
runtime | string | The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive. Specifying a runtime results in an error if you're deploying a function using a container image. The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see Runtime use after deprecation. For a list of all currently supported runtimes, see Supported runtimes. (nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, nodejs14.x, nodejs16.x, nodejs18.x, nodejs20.x, nodejs22.x, nodejs24.x, java8, java8.al2, java11, java17, java21, java25, python2.7, python3.6, python3.7, python3.8, python3.9, python3.10, python3.11, python3.12, python3.13, python3.14, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, dotnet6, dotnet8, dotnet10, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, ruby3.2, ruby3.3, ruby3.4, ruby4.0, provided, provided.al2, provided.al2023, nodejs26.x, python3.15, java8.al2023, java11.al2023, java17.al2023) |
runtime_version_config | object | The ARN of the runtime and any errors that occured. |
signing_job_arn | string | The ARN of the signing job. (pattern: <code>arn:(aws[a-zA-Z0-9-]):([a-zA-Z0-9-])+:((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1})?:(\d{12})?:(.)</code>) |
signing_profile_version_arn | string | The ARN of the signing profile version. (pattern: <code>arn:(aws[a-zA-Z0-9-]):([a-zA-Z0-9-])+:((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1})?:(\d{12})?:(.)</code>) |
snap_start | object | Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Improving startup performance with Lambda SnapStart. |
state | string | The current state of the function. When the state is Inactive, you can reactivate the function by invoking it. (Pending, Active, Inactive, Failed, Deactivating, Deactivated, ActiveNonInvocable, Deleting) |
state_reason | string | The reason for the function's current state. |
state_reason_code | string | The reason code for the function's current state. When the code is Creating, you can't invoke or modify the function. (Idle, Creating, Restoring, EniLimitExceeded, InsufficientRolePermissions, InvalidConfiguration, InternalError, SubnetOutOfIPAddresses, InvalidSubnet, InvalidSecurityGroup, ImageDeleted, ImageAccessDenied, InvalidImage, KMSKeyAccessDenied, KMSKeyNotFound, InvalidStateKMSKey, DisabledKMSKey, EFSIOError, EFSMountConnectivityError, EFSMountFailure, EFSMountTimeout, InvalidRuntime, InvalidZipFileException, FunctionError, ServiceQuotaExceededException, VcpuLimitExceeded, CapacityProviderScalingLimitExceeded, InsufficientCapacity, EC2RequestLimitExceeded, FunctionError.InitTimeout, FunctionError.RuntimeInitError, FunctionError.ExtensionInitError, FunctionError.InvalidEntryPoint, FunctionError.InvalidWorkingDirectory, FunctionError.PermissionDenied, FunctionError.TooManyExtensions, FunctionError.InitResourceExhausted, DisallowedByVpcEncryptionControl, DrainingDurableExecutions, DependencyError) |
tenancy_config | object | Specifies the tenant isolation mode configuration for a Lambda function. This allows you to configure specific tenant isolation strategies for your function invocations. Tenant isolation configuration cannot be modified after function creation. |
timeout | integer | The amount of time in seconds that Lambda allows a function to run before stopping it. |
tracing_config | object | The function's X-Ray tracing configuration. |
version | string | The version of the Lambda function. (pattern: <code>($LATEST|[0-9]+)</code>) |
vpc_config | object | The function's networking configuration. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_function | select | function_name, region | Qualifier | Returns information about the function or function version, with a link to download the deployment package that's valid for 10 minutes. If you specify a function version, only details that are specific to that version are returned. |
list_functions | select | region | MasterRegion, FunctionVersion, Marker, MaxItems | Returns a list of Lambda functions, with the version-specific configuration of each. Lambda returns up to 50 functions per call. Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version. The ListFunctions operation returns a subset of the FunctionConfiguration fields. To get the additional fields (State, StateReasonCode, StateReason, LastUpdateStatus, LastUpdateStatusReason, LastUpdateStatusReasonCode, RuntimeVersionConfig) for a function or version, use GetFunction. |
create_function | insert | region, FunctionName | Creates a Lambda function. To create a function, you need a deployment package and an execution role. The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use Amazon Web Services services, such as Amazon CloudWatch Logs for log streaming and X-Ray for request tracing. If the deployment package is a container image, then you set the package type to Image. For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties. If the deployment package is a .zip file archive, then you set the package type to Zip. For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64 or arm64). If you do not specify the architecture, then the default value is x86-64. When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State, StateReason, and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Lambda function states. A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration. The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function, and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency). You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set of signing profiles, which define the trusted publishers for this function. If another Amazon Web Services account or an Amazon Web Services service invokes your function, use AddPermission to grant permission by creating a resource-based Identity and Access Management (IAM) policy. You can grant permissions at the function level, on a version, or on an alias. To invoke your function directly, use Invoke. To invoke your function in response to events in other Amazon Web Services services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Lambda functions. | |
add_permission | update | function_name, region, StatementId, Action, Principal | Qualifier | Grants a principal permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function. Note: Lambda does not support adding policies to version $LATEST. To grant permission to another account, specify the account ID as the Principal. To grant permission to an organization defined in Organizations, specify the organization ID as the PrincipalOrgID. For Amazon Web Services services, the principal is a domain-style identifier that the service defines, such as s3.amazonaws.com or sns.amazonaws.com. For Amazon Web Services services, you can also specify the ARN of the associated resource as the SourceArn. If you grant permission to a service principal without specifying the source, other accounts could potentially configure resources in their account to invoke your Lambda function. This operation adds a statement to a resource-based permissions policy for the function. For more information about function policies, see Using resource-based policies for Lambda. |
remove_permission | update | function_name, statement_id, region | Qualifier, RevisionId | Revokes function-use permission from an Amazon Web Services service or another Amazon Web Services account. You can get the ID of the statement from the output of GetPolicy. |
update_function_code | update | function_name, region | Updates a Lambda function's code. If code signing is enabled for the function, the code package must be signed by a trusted publisher. For more information, see Configuring code signing for Lambda. If the function's package type is Image, then you must specify the code package in ImageUri as the URI of a container image in the Amazon ECR registry. If the function's package type is Zip, then you must specify the deployment package as a .zip file archive. Enter the Amazon S3 bucket and key of the code .zip file location. You can also provide the function code inline using the ZipFile field. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64 or arm64). The function's code is locked when you publish a version. You can't modify the code of a published version, only the unpublished version. For a function defined as a container image, Lambda resolves the image tag to an image digest. In Amazon ECR, if you update the image tag to a new image, Lambda does not automatically update the function. | |
delete_function | delete | function_name, region | Qualifier | Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted. This doesn't require the user to have explicit permissions for DeleteAlias. A deleted Lambda function cannot be recovered. Ensure that you specify the correct function name and version before deleting. To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For Amazon Web Services services and resources that invoke your function directly, delete the trigger in the service where you originally configured it. |
invoke | exec | function_name, region | X-Amz-Invocation-Type, X-Amz-Log-Type, X-Amz-Client-Context, X-Amz-Durable-Execution-Name, Qualifier, X-Amz-Tenant-Id | Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By default, Lambda invokes your function synchronously (i.e. theInvocationType is RequestResponse). To invoke a function asynchronously, set InvocationType to Event. Lambda passes the ClientContext object to your function for synchronous invocations only. For synchronous invocations, the maximum payload size is 6 MB. For asynchronous invocations, the maximum payload size is 1 MB. For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace. When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see Error handling and automatic retries in Lambda. For asynchronous invocation, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue. The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, quota errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if running the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded) or function level (ReservedFunctionConcurrentInvocationLimitExceeded). For functions with a long timeout, your client might disconnect during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings. This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts. |
invoke_async | exec | function_name, region, InvokeArgs | For asynchronous function invocation, use Invoke. Invokes a function asynchronously. The payload limit is 256KB. For larger payloads, for up to 1MB, use Invoke. If you do use the InvokeAsync action, note that it doesn't support the use of X-Ray active tracing. Trace ID is not propagated to the function, even if X-Ray active tracing is turned on. | |
invoke_with_response_stream | exec | function_name, region | X-Amz-Log-Type, X-Amz-Client-Context, Qualifier, X-Amz-Tenant-Id, X-Amz-Invocation-Type | Configure your Lambda functions to stream response payloads back to clients. For more information, see Configuring a Lambda function to stream responses. This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts. |
publish_version | exec | function_name, region | Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change. Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version. Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
function_name | string | The name or ARN of the Lambda function. Name formats Function name - MyFunction. Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction. Partial ARN - 123456789012:function:MyFunction. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length. |
region | string | AWS region (default: us-east-1) |
statement_id | string | Statement ID of the permission to remove. |
FunctionVersion | string | Set to ALL to include entries for all published versions of each function. |
Marker | string | Specify the pagination token that's returned by a previous request to retrieve the next page of results. |
MasterRegion | string | For Lambda@Edge functions, the Amazon Web Services Region of the master function. For example, us-east-1 filters the list of functions to include only Lambda@Edge functions replicated from a master function in US East (N. Virginia). If specified, you must set FunctionVersion to ALL. |
MaxItems | integer | The maximum number of functions to return in the response. Note that ListFunctions returns a maximum of 50 items in each response, even if you set the number higher. |
Qualifier | string | The alias name. |
RevisionId | string | Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it. |
X-Amz-Client-Context | string | Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. |
X-Amz-Durable-Execution-Name | string | A unique name for the durable execution. If you invoke a durable function using a name that already exists with the same payload, Lambda returns the existing execution instead of creating a duplicate. If the payload differs, Lambda returns a DurableExecutionAlreadyStartedException error. If not specified, Lambda generates a unique identifier automatically. For more information, see Execution names. |
X-Amz-Invocation-Type | string | Use one of the following options: RequestResponse (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data. DryRun – Validate parameter values and verify that the IAM user or role has permission to invoke the function. |
X-Amz-Log-Type | string | Set to Tail to include the execution log in the response. Applies to synchronously invoked functions only. |
X-Amz-Tenant-Id | string | The identifier of the tenant in a multi-tenant Lambda function. |
SELECT examples
- get_function
- list_functions
Returns information about the function or function version, with a link to download the deployment package that's valid for 10 minutes. If you specify a function version, only details that are specific to that version are returned.
SELECT
code,
concurrency,
configuration,
tags,
tags_error
FROM aws.lambda.functions
WHERE function_name = '{{ function_name }}' -- required
AND region = '{{ region }}' -- required
AND Qualifier = '{{ Qualifier }}'
;
Returns a list of Lambda functions, with the version-specific configuration of each. Lambda returns up to 50 functions per call. Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version. The ListFunctions operation returns a subset of the FunctionConfiguration fields. To get the additional fields (State, StateReasonCode, StateReason, LastUpdateStatus, LastUpdateStatusReason, LastUpdateStatusReasonCode, RuntimeVersionConfig) for a function or version, use GetFunction.
SELECT
architectures,
capacity_provider_config,
code_sha_256,
code_size,
config_sha_256,
dead_letter_config,
description,
durable_config,
environment,
ephemeral_storage,
file_system_configs,
function_arn,
function_name,
handler,
image_config_response,
kms_key_arn,
last_modified,
last_update_status,
last_update_status_reason,
last_update_status_reason_code,
layers,
logging_config,
master_arn,
memory_size,
package_type,
revision_id,
role,
runtime,
runtime_version_config,
signing_job_arn,
signing_profile_version_arn,
snap_start,
state,
state_reason,
state_reason_code,
tenancy_config,
timeout,
tracing_config,
version,
vpc_config
FROM aws.lambda.functions
WHERE region = '{{ region }}' -- required
AND MasterRegion = '{{ MasterRegion }}'
AND FunctionVersion = '{{ FunctionVersion }}'
AND Marker = '{{ Marker }}'
AND MaxItems = '{{ MaxItems }}'
;
INSERT examples
- create_function
- Manifest
Creates a Lambda function. To create a function, you need a deployment package and an execution role. The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use Amazon Web Services services, such as Amazon CloudWatch Logs for log streaming and X-Ray for request tracing. If the deployment package is a container image, then you set the package type to Image. For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties. If the deployment package is a .zip file archive, then you set the package type to Zip. For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64 or arm64). If you do not specify the architecture, then the default value is x86-64. When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State, StateReason, and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Lambda function states. A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration. The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function, and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency). You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set of signing profiles, which define the trusted publishers for this function. If another Amazon Web Services account or an Amazon Web Services service invokes your function, use AddPermission to grant permission by creating a resource-based Identity and Access Management (IAM) policy. You can grant permissions at the function level, on a version, or on an alias. To invoke your function directly, use Invoke. To invoke your function in response to events in other Amazon Web Services services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Lambda functions.
INSERT INTO aws.lambda.functions (
FunctionName,
Runtime,
Role,
Handler,
Code,
Description,
Timeout,
MemorySize,
Publish,
PublishTo,
VpcConfig,
PackageType,
DeadLetterConfig,
Environment,
KMSKeyArn,
TracingConfig,
Tags,
Layers,
FileSystemConfigs,
CodeSigningConfigArn,
ImageConfig,
Architectures,
EphemeralStorage,
SnapStart,
LoggingConfig,
TenancyConfig,
CapacityProviderConfig,
DurableConfig,
region
)
SELECT
'{{ FunctionName }}' /* required */,
'{{ Runtime }}',
'{{ Role }}',
'{{ Handler }}',
'{{ Code }}',
'{{ Description }}',
{{ Timeout }},
{{ MemorySize }},
{{ Publish }},
'{{ PublishTo }}',
'{{ VpcConfig }}',
'{{ PackageType }}',
'{{ DeadLetterConfig }}',
'{{ Environment }}',
'{{ KMSKeyArn }}',
'{{ TracingConfig }}',
'{{ Tags }}',
'{{ Layers }}',
'{{ FileSystemConfigs }}',
'{{ CodeSigningConfigArn }}',
'{{ ImageConfig }}',
'{{ Architectures }}',
'{{ EphemeralStorage }}',
'{{ SnapStart }}',
'{{ LoggingConfig }}',
'{{ TenancyConfig }}',
'{{ CapacityProviderConfig }}',
'{{ DurableConfig }}',
'{{ region }}'
RETURNING
architectures,
capacity_provider_config,
code_sha_256,
code_size,
config_sha_256,
dead_letter_config,
description,
durable_config,
environment,
ephemeral_storage,
file_system_configs,
function_arn,
function_name,
handler,
image_config_response,
kms_key_arn,
last_modified,
last_update_status,
last_update_status_reason,
last_update_status_reason_code,
layers,
logging_config,
master_arn,
memory_size,
package_type,
revision_id,
role,
runtime,
runtime_version_config,
signing_job_arn,
signing_profile_version_arn,
snap_start,
state,
state_reason,
state_reason_code,
tenancy_config,
timeout,
tracing_config,
version,
vpc_config
;
# Description fields are for documentation purposes
- name: functions
props:
- name: region
value: "{{ region }}"
description: Required parameter for the functions resource.
- name: FunctionName
value: "{{ FunctionName }}"
- name: Runtime
value: "{{ Runtime }}"
valid_values: ['nodejs', 'nodejs4.3', 'nodejs6.10', 'nodejs8.10', 'nodejs10.x', 'nodejs12.x', 'nodejs14.x', 'nodejs16.x', 'nodejs18.x', 'nodejs20.x', 'nodejs22.x', 'nodejs24.x', 'java8', 'java8.al2', 'java11', 'java17', 'java21', 'java25', 'python2.7', 'python3.6', 'python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'python3.12', 'python3.13', 'python3.14', 'dotnetcore1.0', 'dotnetcore2.0', 'dotnetcore2.1', 'dotnetcore3.1', 'dotnet6', 'dotnet8', 'dotnet10', 'nodejs4.3-edge', 'go1.x', 'ruby2.5', 'ruby2.7', 'ruby3.2', 'ruby3.3', 'ruby3.4', 'ruby4.0', 'provided', 'provided.al2', 'provided.al2023', 'nodejs26.x', 'python3.15', 'java8.al2023', 'java11.al2023', 'java17.al2023']
- name: Role
value: "{{ Role }}"
- name: Handler
value: "{{ Handler }}"
- name: Code
description: |
The code for the Lambda function. You can either specify an object in Amazon S3, upload a .zip file archive deployment package directly, or specify the URI of a container image.
value:
ZipFile: "{{ ZipFile }}"
S3Bucket: "{{ S3Bucket }}"
S3Key: "{{ S3Key }}"
S3ObjectVersion: "{{ S3ObjectVersion }}"
S3ObjectStorageMode: "{{ S3ObjectStorageMode }}"
ImageUri: "{{ ImageUri }}"
SourceKMSKeyArn: "{{ SourceKMSKeyArn }}"
- name: Description
value: "{{ Description }}"
- name: Timeout
value: {{ Timeout }}
- name: MemorySize
value: {{ MemorySize }}
- name: Publish
value: {{ Publish }}
- name: PublishTo
value: "{{ PublishTo }}"
valid_values: ['LATEST_PUBLISHED']
- name: VpcConfig
description: |
The VPC security groups and subnets that are attached to a Lambda function. For more information, see Configuring a Lambda function to access resources in a VPC.
value:
SubnetIds:
- "{{ SubnetIds }}"
SecurityGroupIds:
- "{{ SecurityGroupIds }}"
Ipv6AllowedForDualStack: {{ Ipv6AllowedForDualStack }}
- name: PackageType
value: "{{ PackageType }}"
valid_values: ['Zip', 'Image']
- name: DeadLetterConfig
description: |
The dead-letter queue for failed asynchronous invocations.
value:
TargetArn: "{{ TargetArn }}"
- name: Environment
description: |
A function's environment variable settings. You can use environment variables to adjust your function's behavior without updating code. An environment variable is a pair of strings that are stored in a function's version-specific configuration.
value:
Variables: "{{ Variables }}"
- name: KMSKeyArn
value: "{{ KMSKeyArn }}"
- name: TracingConfig
description: |
The function's X-Ray tracing configuration. To sample and record incoming requests, set Mode to Active.
value:
Mode: "{{ Mode }}"
- name: Tags
value: "{{ Tags }}"
- name: Layers
value:
- "{{ Layers }}"
- name: FileSystemConfigs
value:
- Arn: "{{ Arn }}"
LocalMountPath: "{{ LocalMountPath }}"
- name: CodeSigningConfigArn
value: "{{ CodeSigningConfigArn }}"
- name: ImageConfig
description: |
Configuration values that override the container image Dockerfile settings. For more information, see Container image settings.
value:
EntryPoint:
- "{{ EntryPoint }}"
Command:
- "{{ Command }}"
WorkingDirectory: "{{ WorkingDirectory }}"
- name: Architectures
value:
- "{{ Architectures }}"
- name: EphemeralStorage
description: |
The size of the function's /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB. For more information, see Configuring ephemeral storage (console).
value:
Size: {{ Size }}
- name: SnapStart
description: |
The function's Lambda SnapStart setting. Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version.
value:
ApplyOn: "{{ ApplyOn }}"
- name: LoggingConfig
description: |
The function's Amazon CloudWatch Logs configuration settings.
value:
LogFormat: "{{ LogFormat }}"
ApplicationLogLevel: "{{ ApplicationLogLevel }}"
SystemLogLevel: "{{ SystemLogLevel }}"
LogGroup: "{{ LogGroup }}"
- name: TenancyConfig
description: |
Specifies the tenant isolation mode configuration for a Lambda function. This allows you to configure specific tenant isolation strategies for your function invocations. Tenant isolation configuration cannot be modified after function creation.
value:
TenantIsolationMode: "{{ TenantIsolationMode }}"
- name: CapacityProviderConfig
description: |
Configuration for the capacity provider that manages compute resources for Lambda functions.
value:
LambdaManagedInstancesCapacityProviderConfig:
CapacityProviderArn: "{{ CapacityProviderArn }}"
PerExecutionEnvironmentMaxConcurrency: {{ PerExecutionEnvironmentMaxConcurrency }}
ExecutionEnvironmentMemoryGiBPerVCpu: {{ ExecutionEnvironmentMemoryGiBPerVCpu }}
- name: DurableConfig
description: |
Configuration settings for durable functions, including execution timeout, retention period for execution history, and an optional ARN of the Key Management Service (KMS) customer managed key that is used to encrypt your durable execution's payload data, including input, output, and error payloads.
value:
KMSKeyArn: "{{ KMSKeyArn }}"
RetentionPeriodInDays: {{ RetentionPeriodInDays }}
ExecutionTimeout: {{ ExecutionTimeout }}
UPDATE examples
- add_permission
- remove_permission
- update_function_code
Grants a principal permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function. Note: Lambda does not support adding policies to version $LATEST. To grant permission to another account, specify the account ID as the Principal. To grant permission to an organization defined in Organizations, specify the organization ID as the PrincipalOrgID. For Amazon Web Services services, the principal is a domain-style identifier that the service defines, such as s3.amazonaws.com or sns.amazonaws.com. For Amazon Web Services services, you can also specify the ARN of the associated resource as the SourceArn. If you grant permission to a service principal without specifying the source, other accounts could potentially configure resources in their account to invoke your Lambda function. This operation adds a statement to a resource-based permissions policy for the function. For more information about function policies, see Using resource-based policies for Lambda.
UPDATE aws.lambda.functions
SET
StatementId = '{{ StatementId }}',
Action = '{{ Action }}',
Principal = '{{ Principal }}',
SourceArn = '{{ SourceArn }}',
FunctionUrlAuthType = '{{ FunctionUrlAuthType }}',
InvokedViaFunctionUrl = {{ InvokedViaFunctionUrl }},
SourceAccount = '{{ SourceAccount }}',
EventSourceToken = '{{ EventSourceToken }}',
RevisionId = '{{ RevisionId }}',
PrincipalOrgID = '{{ PrincipalOrgID }}'
WHERE
function_name = '{{ function_name }}' --required
AND region = '{{ region }}' --required
AND StatementId = '{{ StatementId }}' --required
AND Action = '{{ Action }}' --required
AND Principal = '{{ Principal }}' --required
AND Qualifier = '{{ Qualifier}}'
RETURNING
statement;
Revokes function-use permission from an Amazon Web Services service or another Amazon Web Services account. You can get the ID of the statement from the output of GetPolicy.
UPDATE aws.lambda.functions
SET
-- No updatable properties
WHERE
function_name = '{{ function_name }}' --required
AND statement_id = '{{ statement_id }}' --required
AND region = '{{ region }}' --required
AND Qualifier = '{{ Qualifier}}'
AND RevisionId = '{{ RevisionId}}';
Updates a Lambda function's code. If code signing is enabled for the function, the code package must be signed by a trusted publisher. For more information, see Configuring code signing for Lambda. If the function's package type is Image, then you must specify the code package in ImageUri as the URI of a container image in the Amazon ECR registry. If the function's package type is Zip, then you must specify the deployment package as a .zip file archive. Enter the Amazon S3 bucket and key of the code .zip file location. You can also provide the function code inline using the ZipFile field. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64 or arm64). The function's code is locked when you publish a version. You can't modify the code of a published version, only the unpublished version. For a function defined as a container image, Lambda resolves the image tag to an image digest. In Amazon ECR, if you update the image tag to a new image, Lambda does not automatically update the function.
UPDATE aws.lambda.functions
SET
ZipFile = '{{ ZipFile }}',
S3Bucket = '{{ S3Bucket }}',
S3Key = '{{ S3Key }}',
S3ObjectVersion = '{{ S3ObjectVersion }}',
S3ObjectStorageMode = '{{ S3ObjectStorageMode }}',
ImageUri = '{{ ImageUri }}',
Architectures = '{{ Architectures }}',
Publish = {{ Publish }},
PublishTo = '{{ PublishTo }}',
DryRun = {{ DryRun }},
RevisionId = '{{ RevisionId }}',
SourceKMSKeyArn = '{{ SourceKMSKeyArn }}'
WHERE
function_name = '{{ function_name }}' --required
AND region = '{{ region }}' --required
RETURNING
architectures,
capacity_provider_config,
code_sha_256,
code_size,
config_sha_256,
dead_letter_config,
description,
durable_config,
environment,
ephemeral_storage,
file_system_configs,
function_arn,
function_name,
handler,
image_config_response,
kms_key_arn,
last_modified,
last_update_status,
last_update_status_reason,
last_update_status_reason_code,
layers,
logging_config,
master_arn,
memory_size,
package_type,
revision_id,
role,
runtime,
runtime_version_config,
signing_job_arn,
signing_profile_version_arn,
snap_start,
state,
state_reason,
state_reason_code,
tenancy_config,
timeout,
tracing_config,
version,
vpc_config;
DELETE examples
- delete_function
Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted. This doesn't require the user to have explicit permissions for DeleteAlias. A deleted Lambda function cannot be recovered. Ensure that you specify the correct function name and version before deleting. To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For Amazon Web Services services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.
DELETE FROM aws.lambda.functions
WHERE function_name = '{{ function_name }}' --required
AND region = '{{ region }}' --required
AND Qualifier = '{{ Qualifier }}'
;
Lifecycle Methods
- invoke
- invoke_async
- invoke_with_response_stream
- publish_version
Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By default, Lambda invokes your function synchronously (i.e. theInvocationType is RequestResponse). To invoke a function asynchronously, set InvocationType to Event. Lambda passes the ClientContext object to your function for synchronous invocations only. For synchronous invocations, the maximum payload size is 6 MB. For asynchronous invocations, the maximum payload size is 1 MB. For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace. When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see Error handling and automatic retries in Lambda. For asynchronous invocation, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue. The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, quota errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if running the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded) or function level (ReservedFunctionConcurrentInvocationLimitExceeded). For functions with a long timeout, your client might disconnect during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings. This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts.
EXEC aws.lambda.functions.invoke
@function_name='{{ function_name }}' --required,
@region='{{ region }}' --required,
@X-Amz-Invocation-Type='{{ X-Amz-Invocation-Type }}',
@X-Amz-Log-Type='{{ X-Amz-Log-Type }}',
@X-Amz-Client-Context='{{ X-Amz-Client-Context }}',
@X-Amz-Durable-Execution-Name='{{ X-Amz-Durable-Execution-Name }}',
@Qualifier='{{ Qualifier }}',
@X-Amz-Tenant-Id='{{ X-Amz-Tenant-Id }}'
@@json=
'{
"Payload": "{{ Payload }}"
}'
;
For asynchronous function invocation, use Invoke. Invokes a function asynchronously. The payload limit is 256KB. For larger payloads, for up to 1MB, use Invoke. If you do use the InvokeAsync action, note that it doesn't support the use of X-Ray active tracing. Trace ID is not propagated to the function, even if X-Ray active tracing is turned on.
EXEC aws.lambda.functions.invoke_async
@function_name='{{ function_name }}' --required,
@region='{{ region }}' --required
@@json=
'{
"InvokeArgs": "{{ InvokeArgs }}"
}'
;
Configure your Lambda functions to stream response payloads back to clients. For more information, see Configuring a Lambda function to stream responses. This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts.
EXEC aws.lambda.functions.invoke_with_response_stream
@function_name='{{ function_name }}' --required,
@region='{{ region }}' --required,
@X-Amz-Log-Type='{{ X-Amz-Log-Type }}',
@X-Amz-Client-Context='{{ X-Amz-Client-Context }}',
@Qualifier='{{ Qualifier }}',
@X-Amz-Tenant-Id='{{ X-Amz-Tenant-Id }}',
@X-Amz-Invocation-Type='{{ X-Amz-Invocation-Type }}'
@@json=
'{
"Payload": "{{ Payload }}"
}'
;
Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change. Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version. Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias.
EXEC aws.lambda.functions.publish_version
@function_name='{{ function_name }}' --required,
@region='{{ region }}' --required
@@json=
'{
"CodeSha256": "{{ CodeSha256 }}",
"Description": "{{ Description }}",
"RevisionId": "{{ RevisionId }}",
"PublishTo": "{{ PublishTo }}"
}'
;