├── Dockerfile ├── Dockerfile-v1 └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:stable-slim 2 | WORKDIR /work 3 | RUN apt update && \ 4 | apt install -y zip unzip gnupg curl jq less wget && \ 5 | echo "-----BEGIN PGP PUBLIC KEY BLOCK----- \n\ 6 | \n\ 7 | mQINBF2Cr7UBEADJZHcgusOJl7ENSyumXh85z0TRV0xJorM2B/JL0kHOyigQluUG\n\ 8 | ZMLhENaG0bYatdrKP+3H91lvK050pXwnO/R7fB/FSTouki4ciIx5OuLlnJZIxSzx\n\ 9 | PqGl0mkxImLNbGWoi6Lto0LYxqHN2iQtzlwTVmq9733zd3XfcXrZ3+LblHAgEt5G\n\ 10 | TfNxEKJ8soPLyWmwDH6HWCnjZ/aIQRBTIQ05uVeEoYxSh6wOai7ss/KveoSNBbYz\n\ 11 | gbdzoqI2Y8cgH2nbfgp3DSasaLZEdCSsIsK1u05CinE7k2qZ7KgKAUIcT/cR/grk\n\ 12 | C6VwsnDU0OUCideXcQ8WeHutqvgZH1JgKDbznoIzeQHJD238GEu+eKhRHcz8/jeG\n\ 13 | 94zkcgJOz3KbZGYMiTh277Fvj9zzvZsbMBCedV1BTg3TqgvdX4bdkhf5cH+7NtWO\n\ 14 | lrFj6UwAsGukBTAOxC0l/dnSmZhJ7Z1KmEWilro/gOrjtOxqRQutlIqG22TaqoPG\n\ 15 | fYVN+en3Zwbt97kcgZDwqbuykNt64oZWc4XKCa3mprEGC3IbJTBFqglXmZ7l9ywG\n\ 16 | EEUJYOlb2XrSuPWml39beWdKM8kzr1OjnlOm6+lpTRCBfo0wa9F8YZRhHPAkwKkX\n\ 17 | XDeOGpWRj4ohOx0d2GWkyV5xyN14p2tQOCdOODmz80yUTgRpPVQUtOEhXQARAQAB\n\ 18 | tCFBV1MgQ0xJIFRlYW0gPGF3cy1jbGlAYW1hem9uLmNvbT6JAlQEEwEIAD4WIQT7\n\ 19 | Xbd/1cEYuAURraimMQrMRnJHXAUCXYKvtQIbAwUJB4TOAAULCQgHAgYVCgkICwIE\n\ 20 | FgIDAQIeAQIXgAAKCRCmMQrMRnJHXJIXEAChLUIkg80uPUkGjE3jejvQSA1aWuAM\n\ 21 | yzy6fdpdlRUz6M6nmsUhOExjVIvibEJpzK5mhuSZ4lb0vJ2ZUPgCv4zs2nBd7BGJ\n\ 22 | MxKiWgBReGvTdqZ0SzyYH4PYCJSE732x/Fw9hfnh1dMTXNcrQXzwOmmFNNegG0Ox\n\ 23 | au+VnpcR5Kz3smiTrIwZbRudo1ijhCYPQ7t5CMp9kjC6bObvy1hSIg2xNbMAN/Do\n\ 24 | ikebAl36uA6Y/Uczjj3GxZW4ZWeFirMidKbtqvUz2y0UFszobjiBSqZZHCreC34B\n\ 25 | hw9bFNpuWC/0SrXgohdsc6vK50pDGdV5kM2qo9tMQ/izsAwTh/d/GzZv8H4lV9eO\n\ 26 | tEis+EpR497PaxKKh9tJf0N6Q1YLRHof5xePZtOIlS3gfvsH5hXA3HJ9yIxb8T0H\n\ 27 | QYmVr3aIUes20i6meI3fuV36VFupwfrTKaL7VXnsrK2fq5cRvyJLNzXucg0WAjPF\n\ 28 | RrAGLzY7nP1xeg1a0aeP+pdsqjqlPJom8OCWc1+6DWbg0jsC74WoesAqgBItODMB\n\ 29 | rsal1y/q+bPzpsnWjzHV8+1/EtZmSc8ZUGSJOPkfC7hObnfkl18h+1QtKTjZme4d\n\ 30 | H17gsBJr+opwJw/Zio2LMjQBOqlm3K1A4zFTh7wBC7He6KPQea1p2XAMgtvATtNe\n\ 31 | YLZATHZKTJyiqA==\n\ 32 | =vYOk\n\ 33 | -----END PGP PUBLIC KEY BLOCK-----" > aws-cli.key && \ 34 | gpg --import /work/aws-cli.key && \ 35 | curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip && \ 36 | curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig -o awscliv2.sig && \ 37 | gpg --verify /work/awscliv2.sig /work/awscliv2.zip && \ 38 | unzip awscliv2.zip && \ 39 | ./aws/install && \ 40 | apt --purge autoremove -y zip gnupg curl && \ 41 | rm -rf /var/lib/apt/lists && \ 42 | cd / && rm -rf /work 43 | WORKDIR /aws 44 | -------------------------------------------------------------------------------- /Dockerfile-v1: -------------------------------------------------------------------------------- 1 | FROM python:alpine 2 | 3 | ARG CLI_VERSION=1.18.188 4 | 5 | RUN apk -uv add --no-cache groff jq less && \ 6 | pip install --no-cache-dir awscli==$CLI_VERSION 7 | 8 | WORKDIR /aws 9 | 10 | CMD sh 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AWS CLI Docker Image 2 | 3 | ![Docker Stars](https://img.shields.io/docker/stars/mikesir87/aws-cli.svg) 4 | ![Docker Pulls](https://img.shields.io/docker/pulls/mikesir87/aws-cli.svg) 5 | ![Docker Automated Builds](http://img.shields.io/docker/automated/mikesir87/aws-cli.svg) 6 | 7 | ## Supported tags and Dockerfiles 8 | 9 | - [2.1.6/v2/latest](https://github.com/mikesir87/aws-cli-docker/blob/2.1.6/Dockerfile) 10 | - [1.18.188/v1](https://github.com/mikesir87/aws-cli-docker/blob/1.18.188/Dockerfile) 11 | - [1.17.14](https://github.com/mikesir87/aws-cli-docker/blob/1.17.14/Dockerfile) 12 | - [1.16.312](https://github.com/mikesir87/aws-cli-docker/blob/1.16.312/Dockerfile) 13 | - [1.15.85](https://github.com/mikesir87/aws-cli-docker/blob/1.15.85/Dockerfile) 14 | - [1.14.69](https://github.com/mikesir87/aws-cli-docker/blob/1.14.69/Dockerfile) 15 | - [1.12.1](https://github.com/mikesir87/aws-cli-docker/blob/1.12.1/Dockerfile) 16 | - [1.11.190](https://github.com/mikesir87/aws-cli-docker/blob/1.11.190/Dockerfile) 17 | - [1.10.65](https://github.com/mikesir87/aws-cli-docker/blob/1.10.65/Dockerfile) 18 | 19 | This image provides the AWS CLI and a few other tools, including jq. 20 | 21 | I have an IFTT recipe written to notify me of new releases of the AWS CLI, so should be able to keep up-to-date on it. 22 | 23 | ## Providing Credentials 24 | 25 | Credentials can be provided in any of the aws-cli supported formats. 26 | 27 | ### Using credentials file 28 | 29 | If you need to create the credentials file, you can use the aws-cli configure command by using the following command: 30 | 31 | ``` 32 | docker run --rm -tiv $HOME/.aws:/root/.aws mikesir87/aws-cli aws configure 33 | ``` 34 | 35 | From that point on, simply mount the directory containing your config. 36 | 37 | ``` 38 | docker run --rm -v $HOME/.aws:/root/.aws mikesir87/aws-cli aws s3 ls 39 | ``` 40 | 41 | ### Using environment variables 42 | 43 | This is supported, although NOT encouraged, as the environment variables can end up in command-line history, available for container inspection, etc. 44 | 45 | - AWS_ACCESS_KEY_ID` - specify the access key ID 46 | - AWS_SECRET_ACCESS_KEY` - the secret access key 47 | 48 | ``` 49 | docker run --rm -e AWS_ACCESS_KEY_ID=my-key-id -e AWS_SECRET_ACCESS_KEY=my-secret-access-key -v $(pwd):/aws mikesir87/aws-cli aws s3 ls 50 | ``` 51 | 52 | ## Using the container as a CLI command 53 | 54 | You can setup an alias for `aws` to simply start a container, hiding the fact that it's not actually installed on the machine. Then, updating the version simply becomes a `docker pull mikesir87/aws-cli`. 55 | 56 | ``` 57 | alias aws='docker run --rm -tiv $HOME/.aws:/root/.aws -v $(pwd):/aws mikesir87/aws-cli aws' 58 | ``` 59 | 60 | --------------------------------------------------------------------------------