Docker Community Forums

Share and learn in the Docker community.

How to create EC2 instance by docker-machine with exists key pair?

docker

(Vjingqiangzhang) #1

Use this way to create an instance on aws:

docker-machine create \
  -d amazonec2 \
  --amazonec2-region ap-northeast-1 \
  --amazonec2-zone a \
  --amazonec2-ami ami-XXXXXX \
  --amazonec2-keypair-name my_key_pair \
  --amazonec2-ssh-keypath ~/.ssh/id_rsa \
  my_instance

Can’t connect to it by ssh.

The my_key_pare is a name that exist on aws. The ~/.ssh/id_rsa is local ssh private key. How to set the right value?

I have read the document but didn’t find an example of using both --amazonec2-keypair-name and --amazonec2-ssh-keypath.