If you have tried calling the AWS CLI and got the following error:
Unknown options: --cli-binary-format
Then it is because you are using the AWS CLI v1
and should be using the newer AWS CLI v2
.
Another error that you will see along with this is:
An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could not parse payload into json: Unrecognized token 'eyJwYXRoIjoiJEdMAAAAIgfQo': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
An example that fails on AWS CLI v1
aws lambda invoke --function-name YourFunction --cli-binary-format raw-in-base64-out --payload '{"yourKey":"yourValue"}'
How to fix this error on AWS CLI v1
aws lambda invoke --function-name YourFunction --region eu-west-1 --payload '{"yourKey":"yourValue"}' response.json
How to fix this error by Upgrading to AWS CLI v2
You can follow the guide directly to upgrade your CLI from v1 to v2 here Migrating from AWS CLI version 1 to version 2 – AWS Command Line Interface (amazon.com)
The instructions run through platform specific upgrades migrations:
AWS CLI version 2 migration instructions – AWS Command Line Interface (amazon.com)
How to check your AWS CLI
version
You can check the version your aws
CLI is running by typing:
aws --version