Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Build

```
```shell
docker build -t garland/aws-cli-docker:x.x .
```

Expand Down Expand Up @@ -51,14 +51,15 @@ An automated build of this image is on Docker Hub: https://hub.docker.com/r/garl
## Example Usage:

### Describe an instance:

```shell
docker run \
--env AWS_ACCESS_KEY_ID=<<YOUR_ACCESS_KEY>> \
--env AWS_SECRET_ACCESS_KEY=<<YOUR_SECRET_ACCESS>> \
--env AWS_DEFAULT_REGION=us-east-1 \
garland/aws-cli-docker \
aws ec2 describe-instances --instance-ids i-90949d7a

```
```json
output:

{
Expand All @@ -77,29 +78,30 @@ output:
...
...
}

```
### Return a list of items in s3 bucket

```shell
docker run \
--env AWS_ACCESS_KEY_ID=<<YOUR_ACCESS_KEY>> \
--env AWS_SECRET_ACCESS_KEY=<<YOUR_SECRET_ACCESS>> \
garland/aws-cli-docker \
aws s3 ls
```

output:

2014-06-03 19:41:30 folder1
2014-06-06 23:02:29 folder2

### Upload content of your current directory (say it contains two files _test.txt_ and _test2.txt_) to s3 bucket

```shell
docker run \
--env AWS_ACCESS_KEY_ID=<<YOUR_ACCESS_KEY>> \
--env AWS_SECRET_ACCESS_KEY=<<YOUR_SECRET_ACCESS>> \
-v $PWD:/data \
garland/aws-cli-docker \
aws s3 sync . s3://mybucket

```
output:

(dryrun) upload: test.txt to s3://mybucket/test.txt
Expand All @@ -109,27 +111,28 @@ doc: http://docs.aws.amazon.com/cli/latest/reference/s3/index.html

### Retrieve a decrypted Windows password by passing in your private key
We will map the private keys that resides on your local system to inside the container

```shell
docker run \
-v <<LOCATION_TO_YOUR_PRIVATE_KEYy>>:/tmp/key.pem \
--env AWS_ACCESS_KEY_ID=<<YOUR_ACCESS_KEY>> \
--env AWS_SECRET_ACCESS_KEY=<<YOUR_SECRET_ACCESS>> \
--env AWS_DEFAULT_REGION=us-east-1 \
garland/aws-cli-docker \
aws ec2 get-password-data --instance-id <<YOUR_INSTANCE_ID>> --priv-launch-key /tmp/key.pem

```
Output:

```json
{
"InstanceId": "i-90949d7a",
"Timestamp": "2014-12-11T01:18:27.000Z",
"PasswordData": "8pa%o?foo"
}

```
doc: http://docs.aws.amazon.com/cli/latest/reference/ec2/get-password-data.html

## Example Usage with Docker Compose:

```shell
echo AWS_ACCESS_KEY_ID=ID >> .env
echo AWS_SECRET_ACCESS_KEY=KEY >> .env
docker-compose run aws s3 ls
```