Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CLI execute a lambda function issue

I'm trying to invoke a lambda function from my AWS CLI in windows 10. I've done previously a configuration of my client thru AWS configure.

The command used is:

aws lambda invoke \
    --function-name arn:aws:lambda:us-east-1:111111111:function:xxx \
    --invocation-type RequestResponse

but my system is returning an error aws: error: too few arguments, as shown below:

enter image description here

Could you guys guide me to succeed in this execution?

thanks

like image 604
Andres Urrego Angel Avatar asked Sep 18 '17 15:09

Andres Urrego Angel


2 Answers

In addition to @jarmod's answer: You can use - if want to send output directly to stdout:

aws lambda invoke --function-name my_function --invocation-type RequestResponse --log-type Tail - | grep "LogResult"| awk -F'"' '{print $4}' | base64 --decode

or if you have jq

aws lambda invoke --function-name my_function --invocation-type RequestResponse --log-type Tail - | jq '.LogResult' -r | base64 --decode

like image 152
Putnik Avatar answered Sep 21 '22 14:09

Putnik


It looks like you need to provide an outfile. So re-run it as follows:

aws lambda invoke \
    --function-name arn:aws:lambda:us-east-1:111111111:function:xxx \
    --invocation-type RequestResponse \
    outfile.txt
like image 26
jarmod Avatar answered Sep 18 '22 14:09

jarmod