invoke_async
¶
invoke_async(
function_name: NamespacedFunctionName,
invoke_args: Body[Iterator[bytes]] | Iterator[bytes] | bytes,
*,
config_overrides: Optional[LambdaClientConfig] = None,
) -> InvokeAsyncResponse
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.
Parameters:
-
function_name(NamespacedFunctionName) –The name or ARN of the Lambda function.
Name formats
-
Function name –
my-function. -
Function ARN –
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
Partial ARN –
123456789012:function:my-function.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
-
-
invoke_args(Body[Iterator[bytes]] | Iterator[bytes] | bytes) –The JSON that you want to provide to your Lambda function as input.
Raises:
-
EC2AccessDeniedException–Need additional permissions to configure VPC settings.
-
EC2ThrottledException–Amazon EC2 throttled Lambda during Lambda function initialization using the execution role provided for the function.
-
EC2UnexpectedException–Lambda received an unexpected Amazon EC2 client exception while setting up for the Lambda function.
-
EFSIOException–An error occurred when reading from or writing to a connected file system.
-
EFSMountConnectivityException–The Lambda function couldn't make a network connection to the configured file system.
-
EFSMountFailureException–The Lambda function couldn't mount the configured file system due to a permission or configuration issue.
-
EFSMountTimeoutException–The Lambda function made a network connection to the configured file system, but the mount operation timed out.
-
ENILimitReachedException–Lambda couldn't create an elastic network interface in the VPC, specified as part of Lambda function configuration, because the limit for network interfaces has been reached. For more information, see Lambda quotas.
-
InvalidRequestContentException–The request body could not be parsed as JSON, or a request header is invalid. For example, the 'x-amzn-RequestId' header is not a valid UUID string.
-
InvalidRuntimeException–The runtime or runtime version specified is not supported.
-
InvalidSecurityGroupIDException–The security group ID provided in the Lambda function VPC configuration is not valid.
-
InvalidSubnetIDException–The subnet ID provided in the Lambda function VPC configuration is not valid.
-
KMSAccessDeniedException–Lambda couldn't decrypt the environment variables because KMS access was denied. Check the Lambda function's KMS permissions.
-
KMSDisabledException–Lambda couldn't decrypt the environment variables because the KMS key used is disabled. Check the Lambda function's KMS key settings.
-
KMSInvalidStateException–Lambda couldn't decrypt the environment variables because the state of the KMS key used is not valid for Decrypt. Check the function's KMS key settings.
-
KMSNotFoundException–Lambda couldn't decrypt the environment variables because the KMS key was not found. Check the function's KMS key settings.
-
ModeNotSupportedException–The Lambda function doesn't support the invocation mode requested. For example, calling
InvokewithInvocationType=RequestResponseon a function configured for asynchronous-only invocation, or vice versa. For more information about invocation types, see Invoking Lambda functions. -
ResourceConflictException–The resource already exists, or another operation is in progress.
-
ResourceNotFoundException–The resource specified in the request does not exist.
-
S3FilesMountConnectivityException–The Lambda function couldn't make a network connection to the configured S3 Files access point.
-
S3FilesMountFailureException–The Lambda function couldn't mount the configured S3 Files access point due to a permission or configuration issue.
-
S3FilesMountTimeoutException–The Lambda function made a network connection to the configured S3 Files access point, but the mount operation timed out.
-
ServiceException–The Lambda service encountered an internal error.
-
ServiceQuotaExceededException–The request would exceed a service quota. For more information about Lambda service quotas, see Lambda quotas. To request a quota increase, see Requesting a quota increase in the Service Quotas User Guide.
-
SnapStartException–The
afterRestore()runtime hook encountered an error. For more information, check the Amazon CloudWatch logs. -
SnapStartNotReadyException–Lambda is initializing your function. You can invoke the function when the function state becomes
Active. -
SnapStartRegenerationFailureException–Lambda couldn't regenerate the SnapStart snapshot for the function. SnapStart-enabled functions periodically regenerate snapshots when their underlying runtime or dependencies change; this regeneration failed. Wait for Lambda to retry, or update the function's configuration to trigger a new snapshot. For more information, see Lambda SnapStart.
-
SnapStartTimeoutException–Lambda couldn't restore the snapshot within the timeout limit.
-
SubnetIPAddressLimitReachedException–Lambda couldn't set up VPC access for the Lambda function because one or more configured subnets has no available IP addresses.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To invoke a Lambda function asynchronously The following example invokes a Lambda function asynchronously
Source code in docs_src/capo_lambda/_services/_lambda.py
4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 | |