If docker-machine behaves like it's drunk:

docker-machine ls

NAME                    ACTIVE   DRIVER       STATE     URL                         SWARM
default                          virtualbox   Running   tcp://192.168.99.100:2376
menagerie                        amazonec2    Running   tcp://52.5.243.251:2376
menagerie-staging-a              amazonec2    Running   tcp://52.1.47.168:2376
s2-bouncer                       amazonec2    Running   tcp://54.175.231.64:2376
s2-dynamodb-publisher            amazonec2    Running   tcp://54.175.231.64:2376

To start a connection on the local shell to docker:

eval $(docker-machine env <machine_name>)

Then export DOCKER_HOST with the right IP.

$(export DOCKER_HOST="tcp://54.85.195.55:2376")

To connect to the EC2 instance just do it manually:

ssh -i ~/.docker/machine/machines/<machine_name>/id_rsa ubuntu@54.85.135.22

It happened to me that the docker configuration files were lost. Had to manually add values to the json files to be able to connect again to EC2 instances.