├── 0.1 ├── Dockerfile └── docker-compose.yml ├── 0.2 ├── Dockerfile └── docker-compose.yml ├── 1.15.47 ├── Dockerfile └── docker-compose.yml ├── 1.16.140 ├── Dockerfile └── docker-compose.yml ├── Dockerfile ├── LICENSE ├── README.md └── docker-compose.yml /0.1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | RUN apk --no-cache update && \ 4 | apk --no-cache add python py-pip py-setuptools ca-certificates groff less && \ 5 | pip --no-cache-dir install awscli && \ 6 | rm -rf /var/cache/apk/* 7 | 8 | WORKDIR /data 9 | -------------------------------------------------------------------------------- /0.1/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | aws: 4 | image: garland/aws-cli-docker 5 | entrypoint: aws 6 | environment: 7 | - AWS_ACCESS_KEY_ID 8 | - AWS_SECRET_ACCESS_KEY 9 | - AWS_DEFAULT_REGION 10 | -------------------------------------------------------------------------------- /0.2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.6 2 | 3 | # Versions: https://pypi.python.org/pypi/awscli#downloads 4 | ENV AWS_CLI_VERSION 1.11.131 5 | 6 | RUN apk --no-cache update && \ 7 | apk --no-cache add python py-pip py-setuptools ca-certificates groff less && \ 8 | pip --no-cache-dir install awscli==${AWS_CLI_VERSION} && \ 9 | rm -rf /var/cache/apk/* 10 | 11 | WORKDIR /data 12 | -------------------------------------------------------------------------------- /0.2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | aws: 4 | image: garland/aws-cli-docker 5 | entrypoint: aws 6 | environment: 7 | - AWS_ACCESS_KEY_ID 8 | - AWS_SECRET_ACCESS_KEY 9 | - AWS_DEFAULT_REGION 10 | -------------------------------------------------------------------------------- /1.15.47/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.6 2 | 3 | # Versions: https://pypi.python.org/pypi/awscli#downloads 4 | ENV AWS_CLI_VERSION 1.15.47 5 | 6 | RUN apk --no-cache update && \ 7 | apk --no-cache add python py-pip py-setuptools ca-certificates groff less && \ 8 | pip --no-cache-dir install awscli==${AWS_CLI_VERSION} && \ 9 | rm -rf /var/cache/apk/* 10 | 11 | WORKDIR /data 12 | -------------------------------------------------------------------------------- /1.15.47/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | aws: 4 | image: garland/aws-cli-docker 5 | entrypoint: aws 6 | environment: 7 | - AWS_ACCESS_KEY_ID 8 | - AWS_SECRET_ACCESS_KEY 9 | - AWS_DEFAULT_REGION 10 | -------------------------------------------------------------------------------- /1.16.140/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.0a3-alpine3.9 2 | 3 | # Versions: https://pypi.python.org/pypi/awscli#downloads 4 | ENV AWS_CLI_VERSION 1.16.140 5 | 6 | RUN apk --no-cache update && \ 7 | apk --no-cache add ca-certificates groff less && \ 8 | pip3 --no-cache-dir install awscli==${AWS_CLI_VERSION} && \ 9 | rm -rf /var/cache/apk/* 10 | 11 | WORKDIR /data 12 | -------------------------------------------------------------------------------- /1.16.140/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | aws: 4 | image: garland/aws-cli-docker 5 | entrypoint: aws 6 | environment: 7 | - AWS_ACCESS_KEY_ID 8 | - AWS_SECRET_ACCESS_KEY 9 | - AWS_DEFAULT_REGION 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.0a3-alpine3.9 2 | 3 | # Versions: https://pypi.python.org/pypi/awscli#downloads 4 | ENV AWS_CLI_VERSION 1.16.140 5 | 6 | RUN apk --no-cache update && \ 7 | apk --no-cache add ca-certificates groff less && \ 8 | pip3 --no-cache-dir install awscli==${AWS_CLI_VERSION} && \ 9 | rm -rf /var/cache/apk/* 10 | 11 | WORKDIR /data 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Garland kan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AWS CLI Docker Container 2 | [![GitHub forks](https://img.shields.io/github/forks/sekka1/aws-cli-docker.svg)](https://github.com/sekka1/aws-cli-docker/network) 3 | [![GitHub stars](https://img.shields.io/github/stars/sekka1/aws-cli-docker.svg)](https://github.com/sekka1/aws-cli-docker/stargazers) 4 | [![GitHub issues](https://img.shields.io/github/issues/sekka1/aws-cli-docker.svg)](https://github.com/sekka1/aws-cli-docker/issues) 5 | [![Twitter](https://img.shields.io/twitter/url/https/github.com/sekka1/aws-cli-docker.svg?style=social)](https://twitter.com/intent/tweet?text=AWS%20CLI%20in%20a%20%40Docker%20container%20%40AWSCLI:&url=https://github.com/sekka1/aws-cli-docker) 6 | [![Docker Pulls](https://img.shields.io/docker/pulls/garland/aws-cli-docker.svg)](https://hub.docker.com/r/garland/aws-cli-docker/) 7 | [![Docker Stars](https://img.shields.io/docker/stars/garland/aws-cli-docker.svg)](https://hub.docker.com/r/garland/aws-cli-docker/) 8 | 9 | 10 | # Supported tags and respective `Dockerfile` links 11 | 12 | - [`0.1` (*0.1/Dockerfile*)](https://github.com/sekka1/aws-cli-docker/blob/0.1/0.1/Dockerfile) 13 | - [`0.2` (*0.2/Dockerfile*)](https://github.com/sekka1/aws-cli-docker/blob/0.2/0.2/Dockerfile) 14 | - [`1.15.47` (*1.15.47/Dockerfile*)](https://github.com/sekka1/aws-cli-docker/tree/master/1.15.47) 15 | - [`1.16.140` (*1.16.140/Dockerfile*)](https://github.com/sekka1/aws-cli-docker/tree/master/1.16.140) 16 | 17 | # AWS CLI Version 18 | 19 | * [1.16.140](https://github.com/aws/aws-cli/releases/tag/1.16.140) 20 | 21 | # Build 22 | 23 | ``` 24 | docker build -t garland/aws-cli-docker:x.x . 25 | ``` 26 | 27 | # Description 28 | 29 | Docker container with the AWS CLI installed. 30 | 31 | Using [Alpine linux](https://hub.docker.com/_/alpine/). The Docker image is 87MB 32 | 33 | An automated build of this image is on Docker Hub: https://hub.docker.com/r/garland/aws-cli-docker/ 34 | 35 | ## Getting your AWS Keys: 36 | 37 | [http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#cli-signup](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#cli-signup) 38 | 39 | ## Passing your keys into this container via environmental variables: 40 | 41 | [http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment) 42 | 43 | ## Command line options for things like setting the region 44 | 45 | [http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-command-line](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-command-line) 46 | 47 | ## You can run any commands available to the AWS CLI 48 | 49 | [http://docs.aws.amazon.com/cli/latest/index.html](http://docs.aws.amazon.com/cli/latest/index.html) 50 | 51 | ## Example Usage: 52 | 53 | ### Describe an instance: 54 | 55 | docker run \ 56 | --env AWS_ACCESS_KEY_ID=<> \ 57 | --env AWS_SECRET_ACCESS_KEY=<> \ 58 | --env AWS_DEFAULT_REGION=us-east-1 \ 59 | garland/aws-cli-docker \ 60 | aws ec2 describe-instances --instance-ids i-90949d7a 61 | 62 | output: 63 | 64 | { 65 | "Reservations": [ 66 | { 67 | "OwnerId": "960288280607", 68 | "ReservationId": "r-1bb15137", 69 | "Groups": [], 70 | "RequesterId": "226008221399", 71 | "Instances": [ 72 | { 73 | "Monitoring": { 74 | "State": "enabled" 75 | }, 76 | "PublicDnsName": null, 77 | ... 78 | ... 79 | } 80 | 81 | ### Return a list of items in s3 bucket 82 | 83 | docker run \ 84 | --env AWS_ACCESS_KEY_ID=<> \ 85 | --env AWS_SECRET_ACCESS_KEY=<> \ 86 | garland/aws-cli-docker \ 87 | aws s3 ls 88 | 89 | output: 90 | 91 | 2014-06-03 19:41:30 folder1 92 | 2014-06-06 23:02:29 folder2 93 | 94 | ### Upload content of your current directory (say it contains two files _test.txt_ and _test2.txt_) to s3 bucket 95 | 96 | docker run \ 97 | --env AWS_ACCESS_KEY_ID=<> \ 98 | --env AWS_SECRET_ACCESS_KEY=<> \ 99 | -v $PWD:/data \ 100 | garland/aws-cli-docker \ 101 | aws s3 sync . s3://mybucket 102 | 103 | output: 104 | 105 | (dryrun) upload: test.txt to s3://mybucket/test.txt 106 | (dryrun) upload: test2.txt to s3://mybucket/test2.txt 107 | 108 | doc: http://docs.aws.amazon.com/cli/latest/reference/s3/index.html 109 | 110 | ### Retrieve a decrypted Windows password by passing in your private key 111 | We will map the private keys that resides on your local system to inside the container 112 | 113 | docker run \ 114 | -v <>:/tmp/key.pem \ 115 | --env AWS_ACCESS_KEY_ID=<> \ 116 | --env AWS_SECRET_ACCESS_KEY=<> \ 117 | --env AWS_DEFAULT_REGION=us-east-1 \ 118 | garland/aws-cli-docker \ 119 | aws ec2 get-password-data --instance-id <> --priv-launch-key /tmp/key.pem 120 | 121 | Output: 122 | 123 | { 124 | "InstanceId": "i-90949d7a", 125 | "Timestamp": "2014-12-11T01:18:27.000Z", 126 | "PasswordData": "8pa%o?foo" 127 | } 128 | 129 | doc: http://docs.aws.amazon.com/cli/latest/reference/ec2/get-password-data.html 130 | 131 | ## Example Usage with Docker Compose: 132 | 133 | echo AWS_ACCESS_KEY_ID=ID >> .env 134 | echo AWS_SECRET_ACCESS_KEY=KEY >> .env 135 | docker-compose run aws s3 ls 136 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | aws: 4 | image: garland/aws-cli-docker 5 | entrypoint: aws 6 | environment: 7 | - AWS_ACCESS_KEY_ID 8 | - AWS_SECRET_ACCESS_KEY 9 | - AWS_DEFAULT_REGION 10 | --------------------------------------------------------------------------------