| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/awscli/examples/lambda/ |
Upload File : |
**Example 1: To invoke a Lambda function synchronously**
The following ``invoke`` example invokes the ``my-function`` function synchronously. The ``cli-binary-format`` option is required if you're using AWS CLI version 2. For more information, see `AWS CLI supported global command line options <https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-options.html#cli-configure-options-list>`__ in the *AWS Command Line Interface User Guide*. ::
aws lambda invoke \
--function-name my-function \
--cli-binary-format raw-in-base64-out \
--payload '{ "name": "Bob" }' \
response.json
Output::
{
"ExecutedVersion": "$LATEST",
"StatusCode": 200
}
For more information, see `Invoke a Lambda function synchronously <https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html>`__ in the *AWS Lambda Developer Guide*.
**Example 2: To invoke a Lambda function asynchronously**
The following ``invoke`` example invokes the ``my-function`` function asynchronously. The ``cli-binary-format`` option is required if you're using AWS CLI version 2. For more information, see `AWS CLI supported global command line options <https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-options.html#cli-configure-options-list>`__ in the *AWS Command Line Interface User Guide*. ::
aws lambda invoke \
--function-name my-function \
--invocation-type Event \
--cli-binary-format raw-in-base64-out \
--payload '{ "name": "Bob" }' \
response.json
Output::
{
"StatusCode": 202
}
For more information, see `Invoking a Lambda function asynchronously <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html>`__ in the *AWS Lambda Developer Guide*.