Category Archives: AWS CLI in a Docker Container

AWS CLI IN A DOCKER CONTAINER?

AWS CLI in a Docker Container?

Most of the systems we are using now have Docker on it. Here we will walk you through how to use the container and two of the many useful commands available to the AWS CLI tool.

Starting the Docker container:
It is pretty simple to start the Docker container and get a shell:

AWS CLI

Once you are in the shell, you can use any of the supported commands.  For example, you can copy/upload items to S3, list ec2 instances, and start ec2 instances.

Copy files to S3:

If you have set of files on your local server that you want to copy over to S3, you can use the tool to do that. I’ve written instructions for copying over files in /opt/database to s3://garland.public.bucket/database below.

First, you need to restart the container and map the directory you want to copy over.

Capture

This adds the Docker -v option which maps a path from your local server to inside the container.  The format is /local/path:/inside/cvontainer/path.