A docker image with AWSCLI installed
Please find all available tags here.
Tags of this project represent the release tags of awscli. Whenever there is a new release tag available in awscli, the latest will be updated and the new tag will be added within eight hour.
As this image is mainly useful in a CI context, jq is also provided in it, to parse some awscli response.
To be able to try these examples you need to have valid credentials in ~/.aws/credentials on your host machine. To set it up, you may follow the instructions here.
docker$ docker run \
--mount type=bind,src=$HOME/.aws,dst=/root/.aws \
--rm \
brainstation/awscli:2 \
aws sts get-caller-identity
{
"UserId": "<user id>",
"Account": "<account number>",
"Arn": "<user or role arn>"
}
docker-composedocker-compose.yml
version: '3'
services:
who-am-i-1:
image: brainstation/awscli:latest
working_dir: /opt/code
volumes:
- .:/opt/code
- $HOME/.aws:/root/.aws
command: ./task.sh
who-am-i-2:
image: brainstation/awscli:latest
volumes:
- $HOME/.aws:/root/.aws
command: bash -c -e "
aws sts get-caller-identity &&
echo \"Hello World!\"
"
task.sh
#!/usr/bin/env bash
UserId=$(aws sts get-caller-identity | jq -r '.UserId')
echo "My user id: $UserId"
Execution output:
$ docker-compose run --rm who-am-i-1
My user id: ABCDEFG3H5IJK4NXYAYJ4
$ docker-compose run --rm who-am-i-2
{
"UserId": "<user id>",
"Account": "<account number>",
"Arn": "<user or role arn>"
}
Hello World!
Content type
Image
Digest
sha256:9d4c9dd1c…
Size
277.2 MB
Last updated
over 2 years ago
docker pull brainstation/awscli