Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using awslogs driver for docker with docker-machine

Make a docker-machine with AWS Credentials

Obviously, you'll need to make credentials first.

$ docker-machine create -d virtualbox \
    --engine-env AWS_REGION=us-east-1 \
    --engine-env AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxx \
    --engine-env AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxx \

Make that your active machine

$ docker-machine env awslogs

Make a log group for the logs in cloudwatch named 'my-log-group'

Log some stuff to cloudwatch

docker run \
    --log-driver=awslogs \
    --log-opt awslogs-region=us-east-1 \
    --log-opt awslogs-group=my-log-group \
    --log-opt awslogs-stream=hello-world-logs \

This comment has been minimized.

Copy link
Owner Author

kurtroberts commented Sep 24, 2018

You could also use the amazonec2 driver and make a role that gives the machine access to cloudwatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.