A way to use the AWS CLI through docker.
If you're on e.g. CoreOS and you don't want to have to install Python or other libraries, use Docker to access S3.
Getting set up
See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html on how to get your access key and credentials
After you have those, run this command to save your AWS creds locally (to the folder
docker run --rm -t -i -v $(pwd)/.awscreds:/root/.aws demandbase/aws-cli-docker configure
Not needed if you have AWS IAM access ^^
Build it, they will come:
Enter your key ID and secret (and any other information) at the prompts. These are now saved at
Use the AWS CLI
From the same directory:
docker run --rm -t -i -v $(pwd)/.awscreds:/root/.aws demandbase/aws-cli-docker my aws commands
If you want to be able to run this from any directory on your machine, replace
$(pwd) in both commands with
See objects in an S3 bucket:
docker run --rm -t -i -v $(pwd)/.awscreds:/root/.aws demandbase/aws-cli-docker s3 ls s3://my-s3-bucket
For more use see http://docs.aws.amazon.com/cli/latest/reference/
Build docker helper to run aws commands inside the container. This is helpful if you want to
later copy those commands over using
docker build -t demandbase/aws-cli-docker:helper -f Dockerfile.helper .
docker run -v $(pwd):/artifacts/ -v ~/.aws/credentials:/root/.aws/credentials -it demandbase/aws-cli-docker:helper --recursive s3 cp s3://demandbase-devops/newrelic .