:doc:`Lambda <../../lambda>` / Client / invoke_async

************
invoke_async
************



.. py:method:: Lambda.Client.invoke_async(**kwargs)

  

  

  .. note::

    

    For asynchronous function invocation, use  Invoke.

    

   

  Invokes a function asynchronously.

   

  .. note::

    

    The payload limit is 256KB. For larger payloads, for up to 1MB, use  Invoke.

    

   

  .. 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 <https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsync>`_  


  **Request Syntax**
  ::

    response = client.invoke_async(
        FunctionName='string',
        InvokeArgs=b'bytes'|file
    )
    
  :type FunctionName: string
  :param FunctionName: **[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.

    

  
  :type InvokeArgs: bytes or seekable file-like object
  :param InvokeArgs: **[REQUIRED]** 

    The JSON that you want to provide to your Lambda function as input.

    

  
  
  :rtype: 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**
  
  *   :py:class:`Lambda.Client.exceptions.InvalidRuntimeException`

  
  *   :py:class:`Lambda.Client.exceptions.ResourceConflictException`

  
  *   :py:class:`Lambda.Client.exceptions.ServiceException`

  
  *   :py:class:`Lambda.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`Lambda.Client.exceptions.InvalidRequestContentException`

  

  **Examples**

  The following example invokes a Lambda function asynchronously
  ::

    response = client.invoke_async(
        FunctionName='my-function',
        InvokeArgs='{}',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'Status': 202,
        'ResponseMetadata': {
            '...': '...',
        },
    }

  