AWS CLI cheatsheet

Install amazon lambda tools and templates

dotnet tool install --global Amazon.Lambda.Tools
dotnet new --install Amazon.Lambda.Templates

Authenticate to AWS with SSO

Check profiles already available locally

aws configure list-profiles

#or
cat ~/.aws/config

Authenticate a profile, in this case aws-profile to connect to corresponding account

aws sso login --profile aws-profile
# test by listing s3 buckets
aws s3 ls --profile aws-profile
#or
dotnet lambda list-functions

Lambda function - download package

Get the url to download the zip package

aws lambda get-function --profile AWS_PROFILE --function-name FUNCTION_NAME --query 'Code.Location' --output text

Invoke lambda function

aws lambda invoke --profile AWS_PROFILE --function-name FUNCTION_NAME output-file --log-type Tail  --query 'LogResult' --output text |  base64 -d