Skip to content

Instantly share code, notes, and snippets.

@shams-ali
Last active June 25, 2016 04:55
Show Gist options
  • Save shams-ali/afb0bd92fdb2c0c216c50febe607f4ec to your computer and use it in GitHub Desktop.
Save shams-ali/afb0bd92fdb2c0c216c50febe607f4ec to your computer and use it in GitHub Desktop.
AWS Docker Create
#If you specified your keys in a credentials file, this command looks like this to create an instance called aws-sandbox:
$ docker-machine create --driver amazonec2 aws-sandbox
#no crednetials file
$ docker-machine create --driver amazonec2 --amazonec2-access-key AKI******* --amazonec2-secret-key 8T93C******* aws-sandbox
# specify a region...default is automaticaally set to us-east-1
$ docker-machine create --driver amazonec2 --amazonec2-region us-west-1 aws-01
#make sure new machine is active host
#to inspect the new aws-sandbox
$ docker-machine inspect aws-sandbox
# expose port 80 from the nginx container and make it accessible on port 80 of the aws-sandbox host
$ docker run -d -p 80:80 --name webserver your-image-name
#make sure to allow http on port 80 on the aws instance from the aws website!!!
#go to url to see it
http://<host_ip>:8000
#incase u dont know how to get ip
$ docker-machine ip <machine name>
#to remove instance
$ docker-machine stop aws-sandbox
$ docker-machine rm aws-sandbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment