[Solved] Unknown choices: –cli-binary-format AWS CLI

0
7
Adv1


Adv2

When you’ve got tried calling the AWS CLI and bought the next error:

Unknown choices: --cli-binary-format

Then it’s since you are utilizing the AWS CLI v1 and needs to be utilizing the newer AWS CLI v2.

One other error that you will note together with that is:

An error occurred (InvalidRequestContentException) when calling the Invoke operation: Couldn't parse request physique into json: Couldn't parse payload into json: Unrecognized token 'eyJwYXRoIjoiJEdMAAAAIgfQo': was anticipating (JSON String, Quantity, Array, Object or token 'null', 'true' or 'false')

An instance that fails on AWS CLI v1

aws lambda invoke --function-name YourFunction --cli-binary-format raw-in-base64-out --payload '{"yourKey":"yourValue"}'

The best way to repair this error on AWS CLI v1

aws lambda invoke --function-name YourFunction --region eu-west-1 --payload '{"yourKey":"yourValue"}' response.json

The best way to repair this error by Upgrading to AWS CLI v2

You possibly can comply with the information on to improve your CLI from v1 to v2 right here Migrating from AWS CLI model 1 to model 2 – AWS Command Line Interface (amazon.com)

The directions run by way of platform particular upgrades migrations:
AWS CLI model 2 migration directions – AWS Command Line Interface (amazon.com)

The best way to verify your AWS CLI model

You possibly can verify the model your aws CLI is working by typing:

aws --version
Adv3