Skip to content

Commit

Permalink
Add README.md and aws helper shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouse committed Jan 22, 2019
1 parent 1b5f9f1 commit d23d0ee
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# AWS CLI in Docker

Containerized AWS CLI on Debian stable to avoid requiring the aws cli to be installed locally.

Includes the SSM Session Manager plugin to allow for remote session access to EC2 instances.

## Build

```
docker build -t jtbouse/aws-cli .
```

Automated build on Docker Hub

[![DockerHub Badge](http://dockeri.co/image/jtbouse/aws-cli)](https://hub.docker.com/r/jtbouse/aws-cli/)

## Usage

Configure:

```
$ aws configure
AWS Access Key ID [None]: accesskey
AWS Secret Access Key [None]: secretkey
Default region name [None]: us-east-1
Default output format [None]:
```

Upload file to S3:

```
$ aws s3 cp ../sample-file.yaml s3://somebucket/example/
```

Caveat: Because `aws` mounts the current directory as `/project`, paths to local files must be relative to the current directory.

Start SSM Session:

```
$ aws ssm start-session --target instance-id-to-connect
```

## Install

To use `aws` as a drop-in replacement for calls to the aws-cli, use one of the following methods:

Add an alias to your shell:

```
alias aws='docker run --rm -t $(tty &>/dev/null && echo "-i") -v ${HOME}/.aws:/root/.aws -v "$(pwd):/project" jtbouse/aws-cli'
```

Or drop it into your path named `aws`:

```
$ curl -o /usr/local/bin/aws https://raw.githubusercontent.com/jtbouse/aws-cli/master/aws
$ chmod a+x /usr/local/bin/aws
```

## Maintenance

- The Docker image build & publish is automated by DockerHub for master commits and tags.
- The awscli and s3cmd packages have handcoded versions in the Dockerfile that need to be bumped manually.

## References

AWS CLI Docs: https://aws.amazon.com/documentation/cli/
14 changes: 14 additions & 0 deletions aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

trap - INT TERM

docker run --rm \
-t $(tty &>/dev/null && echo "-i") \
-v ${HOME}/.aws:/root/.aws \
-v $(pwd):/project \
jtbouse/aws-cli \
$@

0 comments on commit d23d0ee

Please sign in to comment.