From d1001ba061501e5d2c8253abdb0e6b2a6b3e4c3e Mon Sep 17 00:00:00 2001 From: Joel Scheuner Date: Sat, 16 Sep 2023 14:23:55 +0200 Subject: [PATCH] Fix lambda invoke commands with inline payload for AWS CLI v2 (#825) --- .../tools/lambda-tools/debugging/index.md | 32 +++++++++++++++-- .../tools/lambda-tools/hot-reloading/index.md | 36 ++++++++++++++++--- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/content/en/user-guide/tools/lambda-tools/debugging/index.md b/content/en/user-guide/tools/lambda-tools/debugging/index.md index 6b19359220..83893b196b 100644 --- a/content/en/user-guide/tools/lambda-tools/debugging/index.md +++ b/content/en/user-guide/tools/lambda-tools/debugging/index.md @@ -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 @@ -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 diff --git a/content/en/user-guide/tools/lambda-tools/hot-reloading/index.md b/content/en/user-guide/tools/lambda-tools/hot-reloading/index.md index b550704834..eca38a89e6 100644 --- a/content/en/user-guide/tools/lambda-tools/hot-reloading/index.md +++ b/content/en/user-guide/tools/lambda-tools/hot-reloading/index.md @@ -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: @@ -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: