Method: Aws::Lambda::Client#invoke_async

Defined in:
lib/aws-sdk-lambda/client.rb

#invoke_async(params = {}) ⇒ Types::InvokeAsyncResponse

For asynchronous function invocation, use Invoke.

Invokes a function asynchronously.

<note markdown="1"> 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.

</note>

Examples:

Example: To invoke a Lambda function asynchronously


# The following example invokes a Lambda function asynchronously

resp = client.invoke_async({
  function_name: "my-function", 
  invoke_args: "{}", 
})

resp.to_h outputs the following:
{
  status: 202, 
}

Request syntax with placeholder values


resp = client.invoke_async({
  function_name: "NamespacedFunctionName", # required
  invoke_args: "data", # required
})

Response structure


resp.status #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :function_name (required, String)

    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 (required, String, StringIO, File)

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

Returns:

See Also:



4236
4237
4238
4239
# File 'lib/aws-sdk-lambda/client.rb', line 4236

def invoke_async(params = {}, options = {})
  req = build_request(:invoke_async, params)
  req.send_request(options)
end