Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do i pass a string as payload to aws lambda function using aws cli?

I am trying to use the below aws cli command to invoke the lambda function.

aws lambda invoke  --invocation-type RequestResponse  --function-name HelloWorldJava  --payload \"world\" outputfile.txt

But Iam getting below error.

Invalid base64: ""world""

The book I am referring to is using the same method.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your payload has to be JSON according to the docs, but I think there is no hard requirement for that. When you want to pass in a string value directly (JSON or otherwise) you also need to be sure that you pass --cli-binary-format raw-in-base64-out.

So you command should be:

aws lambda invoke  --invocation-type RequestResponse  --function-name HelloWorldJava --cli-binary-format raw-in-base64-out --payload \"world\" outputfile.txt
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading