Alpine-less AWS CLI Docker Image
Credentials can be passed through the following environment variables:
Assuming that these variables are already populated on your machine, you would list all the EC2 instances by issuing the command:
docker run --rm -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY grycap/aws-cli ec2 describe-instances
Further information is available in the AWS CLI documentation.
Usage in AWS Lambda via SCAR
You can run AWS CLI in AWS Lambda via SCAR using the following procedure:
Create the Lambda function
scar init -n lambda-aws-cli grycap/aws-cli
Execute the Lambda function
scar run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY lambda-aws-cli ec2 describe-instances
You have the AWS CLI running on AWS Lambda.