If you end up having the necessities to help each AWS CLI v1 and v2 concurrently, then you should utilize the next conditional in Bash to solely run the precise 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 not assure the AWS CLI model put in. Reminiscent of distributed pipelines, or buyer environments.