Skip to content

Commit

Permalink
Added direct Lambda invoke documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cabeaulac committed Aug 2, 2023
1 parent e198f92 commit 6616cb3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions content/en/user-guide/aws/lambda/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ $ awslocal lambda create-function \
In the old Lambda provider, you could create a function with any arbitrary string as the role, such as `r1`. However, the new provider requires the role ARN to be in the format `arn:aws:iam::000000000000:role/lambda-role` and validates it using an appropriate regex. However, it currently does not check whether the role exists.
{{< /alert >}}

### Invoke the Function with AWS CLI
Invoke the function directly. See ['Lambda CLI invoke docs'](https://docs.aws.amazon.com/cli/latest/reference/lambda/invoke.html)
The command below encodes the body as a JSON string like an event coming from API Gateway or Lambda URL does.

{{< command >}}
$ awslocal lambda invoke --function-name localstack-lambda-url-example \
--cli-binary-format raw-in-base64-out \
--payload '{"body": "{\"num1\": \"10\", \"num2\": \"10\"}" }' output.txt
{{< / command >}}

### Create a Function URL

With the Function URL property, there is now a new way to call a Lambda Function via HTTP API call using the [`CreateFunctionURLConfig` API](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunctionUrlConfig.html). To create a URL for invoking the function, run the following command:
Expand Down

0 comments on commit 6616cb3

Please sign in to comment.