Lambda / Client / invoke_async
invoke_async#
- Lambda.Client.invoke_async(**kwargs)#
Warning
For asynchronous function invocation, use Invoke.
Invokes a function asynchronously.
Note
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.
Danger
This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.
See also: AWS API Documentation
Request Syntax
response = client.invoke_async( FunctionName='string', InvokeArgs=b'bytes'|file )
- Parameters:
FunctionName (string) –
[REQUIRED]
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.
InvokeArgs (bytes or seekable file-like object) –
[REQUIRED]
The JSON that you want to provide to your Lambda function as input.
- Return type:
dict
- Returns:
Response Syntax
{ 'Status': 123 }
Response Structure
(dict) –
A success response (
202 Accepted
) indicates that the request is queued for invocation.Status (integer) –
The status code.
Exceptions
Lambda.Client.exceptions.ServiceException
Lambda.Client.exceptions.ResourceNotFoundException
Lambda.Client.exceptions.InvalidRequestContentException
Lambda.Client.exceptions.InvalidRuntimeException
Lambda.Client.exceptions.ResourceConflictException
Examples
The following example invokes a Lambda function asynchronously
response = client.invoke_async( FunctionName='my-function', InvokeArgs='{}', ) print(response)
Expected Output:
{ 'Status': 202, 'ResponseMetadata': { '...': '...', }, }