invoke_async
async
¶
invoke_async(
function_name: NamespacedFunctionName,
invoke_args: Body[AsyncIterator[bytes]] | AsyncIterator[bytes] | bytes,
*,
config_overrides: Optional[AsyncLambdaClientConfig] = 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[AsyncIterator[bytes]] | AsyncIterator[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/async__lambda.py
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 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 | |