If you end up having the necessities to assist each AWS CLI v1 and v2 concurrently, then you need to use the next conditional in Bash to solely run the particular model required:
AWS_VERSION=$(aws --version | gawk '{print $1}' | gawk -F/ '{print $2}' | gawk -F. '{print $1}')
if [ AWS_VERSION == "1" ]
then
aws lambda invoke --function-name YourFunction --payload $(echo '{"okay":"v"}') response.json
else
aws lambda invoke --function-name YourFunction --cli-binary-format raw-in-base64-out --payload '{"okay":"v"}' response.json
fi
This may be helpful for deploying to environments the place you can’t assure the AWS CLI model put in. Resembling distributed pipelines, or buyer environments.