[AWS CLI] Resolve an Invalid base64 error when running aws lambda invoke

Created on November 28, 2026

If aws lambda invoke returns Invalid base64: *** in AWS CLI version 2, the string passed to --payload may need Base64 encoding. By default, AWS CLI version 2 expects Base64-encoded strings for options that take a blob. You can encode the value before passing it or add --cli-binary-format raw-in-base64-out to accept the raw value for that command.

This example passes a Base64-encoded value.

aws lambda invoke --function example-function --payload `echo 'dummy' | base64` outfile.json

This example uses --cli-binary-format raw-in-base64-out.

aws lambda invoke --cli-binary-format raw-in-base64-out --function-name example-function --payload 'dummy' outfile.json
AWS CLI