Skip to content

Commit

Permalink
Fix lambda invoke commands with inline payload for AWS CLI v2 (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe4dev authored Sep 16, 2023
1 parent 5247ca8 commit d1001ba
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
32 changes: 30 additions & 2 deletions content/en/user-guide/tools/lambda-tools/debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,23 @@ $ awslocal lambda create-function --function-name my-cool-local-function \

We can quickly verify that it works by invoking it with a simple payload:

{{< tabpane text=true persistLang=false >}}
{{% tab header="AWS CLI v1" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name my-cool-local-function --payload '{"message": "Hello from LocalStack!"}' output.txt
$ awslocal lambda invoke --function-name my-cool-local-function \
--payload '{"message": "Hello from LocalStack!"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{% tab header="AWS CLI v2" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name my-cool-local-function \
--cli-binary-format raw-in-base64-out \
--payload '{"message": "Hello from LocalStack!"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{< /tabpane >}}

## Debugging JVM lambdas

Expand Down Expand Up @@ -380,9 +394,23 @@ Now to debug your lambda function, click on the `Debug` icon with
`Attach to Remote Node.js` configuration selected, and then invoke your
lambda function:

{{< tabpane text=true persistLang=false >}}
{{% tab header="AWS CLI v1" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name func1 \
--payload '{"hello":"world"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{% tab header="AWS CLI v2" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name func1 test.lambda.log --payload '{"hello":"world"}'
$ awslocal lambda invoke --function-name func1 \
--cli-binary-format raw-in-base64-out \
--payload '{"hello":"world"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{< /tabpane >}}


## Resources
Expand Down
36 changes: 32 additions & 4 deletions content/en/user-guide/tools/lambda-tools/hot-reloading/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,23 @@ You can also check out some of our [Deployment Configuration Examples](#deployme

We can also quickly make sure that it works by invoking it with a simple payload:

{{< tabpane text=true persistLang=false >}}
{{% tab header="AWS CLI v1" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name my-cool-local-function --payload '{"action": "square", "number": 3}' output.txt
{{< / command >}}
$ awslocal lambda invoke --function-name my-cool-local-function \
--payload '{"action": "square", "number": 3}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{% tab header="AWS CLI v2" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke --function-name my-cool-local-function \
--cli-binary-format raw-in-base64-out \
--payload '{"action": "square", "number": 3}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{< /tabpane >}}

The invocation returns itself returns:

Expand Down Expand Up @@ -297,11 +311,25 @@ awslocal lambda create-function \

You can quickly make sure that it works by invoking it with a simple payload:

{{< tabpane text=true persistLang=false >}}
{{% tab header="AWS CLI v1" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke \
--function-name hello-world \
--payload '{"action": "test"}' output.txt
{{< / command >}}
--payload '{"action": "test"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{% tab header="AWS CLI v2" lang="shell" %}}
{{< command >}}
$ awslocal lambda invoke \
--function-name hello-world \
--cli-binary-format raw-in-base64-out \
--payload '{"action": "test"}' \
output.txt
{{< /command >}}
{{% /tab %}}
{{< /tabpane >}}

The invocation returns itself returns:

Expand Down

0 comments on commit d1001ba

Please sign in to comment.