invoke_async

invoke_async(**kwargs)

Warning

For asynchronous function invocation, use Invoke.

Invokes a function asynchronously.

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 of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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': {
        '...': '...',
    },
}