Friday, May 26, 2023
HomeSoftware EngineeringTips on how to run AWS CLI instructions based mostly on AWS...

Tips on how to run AWS CLI instructions based mostly on AWS CLI Model in Bash


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.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments