The Wayback Machine - https://web.archive.org/web/20160305020356/https://docs.docker.com/machine/drivers/aws/
Get Started
Quickstart containers Understand the architecture
Migrate to Engine 1.10 Breaking changes Deprecated Engine Features FAQ
Release Notes
Learn about Dockerfiles and Docker Cloud Back up data volumes Create a proxy or load balancer Install the Deploy to Docker Cloud button Integrate with Slack Push images to Docker Cloud SSHing into a Docker Cloud-managed node Upgrade Docker Engine on a node Use the Docker Cloud Agent Using the Docker Cloud CLI
API reference
Quickstart contribution FAQ for contributors Where to chat or get help Style guide for Docker documentation

Amazon Web Services

Create machines on Amazon Web Services.

To create machines on Amazon Web Services, you must supply two parameters: the AWS Access Key ID and the AWS Secret Access Key.

Configuring credentials

Before using the amazonec2 driver, ensure that you’ve configured credentials.

AWS credential file

One way to configure credentials is to use the standard credential file for Amazon AWS ~/.aws/credentials file, which might look like:

[default]
aws_access_key_id = AKID1234567890
aws_secret_access_key = MY-SECRET-KEY

You can learn more about the credentials file from this blog post.

This is the simplest case, you can then create a new machine with:

$ docker-machine create --driver amazonec2 aws01

Command line flags

Alternatively, you can use the flags --amazonec2-access-key and --amazonec2-secret-key on the command line:

$ docker-machine create --driver amazonec2 --amazonec2-access-key AKI******* --amazonec2-secret-key 8T93C*******  aws01

Environment variables

You can use environment variables:

$ export AWS_ACCESS_KEY_ID=AKID1234567890
$ export AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY
$ docker-machine create --driver amazonec2 aws01

Options

  • --amazonec2-access-key: Your access key id for the Amazon Web Services API.
  • --amazonec2-secret-key: Your secret access key for the Amazon Web Services API.
  • --amazonec2-session-token: Your session token for the Amazon Web Services API.
  • --amazonec2-ami: The AMI ID of the instance to use.
  • --amazonec2-region: The region to use when launching the instance.
  • --amazonec2-vpc-id: Your VPC ID to launch the instance in.
  • --amazonec2-zone: The AWS zone to launch the instance in (i.e. one of a,b,c,d,e).
  • --amazonec2-subnet-id: AWS VPC subnet id.
  • --amazonec2-security-group: AWS VPC security group name.
  • --amazonec2-tags: AWS extra tag key-value pairs (comma-separated, e.g. key1,value1,key2,value2).
  • --amazonec2-instance-type: The instance type to run.
  • --amazonec2-device-name: The root device name of the instance.
  • --amazonec2-root-size: The root disk size of the instance (in GB).
  • --amazonec2-volume-type: The Amazon EBS volume type to be attached to the instance.
  • --amazonec2-iam-instance-profile: The AWS IAM role name to be used as the instance profile.
  • --amazonec2-ssh-user: The SSH Login username, which must match the default SSH user set in the ami used.
  • --amazonec2-request-spot-instance: Use spot instances.
  • --amazonec2-spot-price: Spot instance bid price (in dollars). Require the --amazonec2-request-spot-instance flag.
  • --amazonec2-use-private-address: Use the private IP address for docker-machine, but still create a public IP address.
  • --amazonec2-private-address-only: Use the private IP address only.
  • --amazonec2-monitoring: Enable CloudWatch Monitoring.
  • --amazonec2-use-ebs-optimized-instance: Create an EBS Optimized Instance, instance type must support it.
  • --amazonec2-ssh-keypath: Path to Private Key file to use for instance. Matching public key with .pub extension should exist

Environment variables and default values:

CLI option Environment variable Default
--amazonec2-access-key AWS_ACCESS_KEY_ID -
--amazonec2-secret-key AWS_SECRET_ACCESS_KEY -
--amazonec2-session-token AWS_SESSION_TOKEN -
--amazonec2-ami AWS_AMI ami-5f709f34
--amazonec2-region AWS_DEFAULT_REGION us-east-1
--amazonec2-vpc-id AWS_VPC_ID -
--amazonec2-zone AWS_ZONE a
--amazonec2-subnet-id AWS_SUBNET_ID -
--amazonec2-security-group AWS_SECURITY_GROUP docker-machine
--amazonec2-tags AWS_TAGS -
--amazonec2-instance-type AWS_INSTANCE_TYPE t2.micro
--amazonec2-device-name AWS_DEVICE_NAME /dev/sda1
--amazonec2-root-size AWS_ROOT_SIZE 16
--amazonec2-volume-type AWS_VOLUME_TYPE gp2
--amazonec2-iam-instance-profile AWS_INSTANCE_PROFILE -
--amazonec2-ssh-user AWS_SSH_USER ubuntu
--amazonec2-request-spot-instance - false
--amazonec2-spot-price - 0.50
--amazonec2-use-private-address - false
--amazonec2-private-address-only - false
--amazonec2-monitoring - false
--amazonec2-use-ebs-optimized-instance - false
--amazonec2-ssh-keypath AWS_SSH_KEYPATH -

Default AMIs

By default, the Amazon EC2 driver will use a daily image of Ubuntu 15.10 LTS.

Region AMI ID
ap-northeast-1 ami-b36d4edd
ap-southeast-1 ami-1069af73
ap-southeast-2 ami-1d336a7e
cn-north-1 ami-79eb2214
eu-west-1 ami-8aa67cf9
eu-central-1 ami-ab0210c7
sa-east-1 ami-185de774
us-east-1 ami-26d5af4c
us-west-1 ami-9cbcd2fc
us-west-2 ami-16b1a077
us-gov-west-1 ami-b0bad893

Security Group

Note that a security group will be created and associated to the host. This security group will have the following ports opened inbound:

  • ssh (22/tcp)
  • docker (2376/tcp)
  • swarm (3376/tcp), only if the node is a swarm master

If you specify a security group yourself using the --amazonec2-security-group flag, the above ports will be checked and opened and the security group modified. If you want more ports to be opened, like application specific ports, use the aws console and modify the configuration manually.

VPC ID

We determine your default vpc id at the start of a command. In some cases, either because your account does not have a default vpc, or you don’t want to use the default one, you can specify a vpc with the --amazonec2-vpc-id flag.

To find the VPC ID:

  1. Login to the AWS console
  2. Go to Services -> VPC -> Your VPCs.
  3. Locate the VPC ID you want from the VPC column.
  4. Go to Services -> VPC -> Subnets. Examine the Availability Zone column to verify that zone a exists and matches your VPC ID.

    For example, us-east1-a is in the a availability zone. If the a zone is not present, you can create a new subnet in that zone or specify a different zone when you create the machine.

To create a machine with a non-default vpc-id:

$ docker-machine create --driver amazonec2 --amazonec2-access-key AKI******* --amazonec2-secret-key 8T93C********* --amazonec2-vpc-id vpc-****** aws02

This example assumes the VPC ID was found in the a availability zone. Use the--amazonec2-zone flag to specify a zone other than the a zone. For example, --amazonec2-zone c signifies us-east1-c.

Custom AMI and SSH username

The default SSH username for the default AMIs is ubuntu.

You need to change the SSH username only if the custom AMI you use has a different SSH username.

You can change the SSH username with the --amazonec2-ssh-user according to the AMI you selected with the --amazonec2-ami.

Mar 5, 2016 at 1:15am (PST) { "docker/apidocs": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/cloud-api-docs": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/cloud-api-docs-layout": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/compose": { "ref": "docs", "repos": [ "[email protected]:docker/compose.git" ], "sha": "9da9555f10abe628e7742476af3f10bd89f68b75" }, "docker/docker": { "ref": "docs", "repos": [ "[email protected]:docker/docker.git" ], "sha": "0e63b073ac8f33335a4d4df3f2aa22120e0b7f43" }, "docker/docker-cloud": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/docker-hub": { "ref": "master", "repos": [ "[email protected]:docker/hub2-demo.git" ], "sha": "73ccb2d678ab0cd83067f0c7ef6f3923d750c7bd" }, "docker/docker-trusted-registry": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/docs-base": { "ref": "master", "repos": [ "[email protected]:docker/docs-base.git" ], "sha": "5a4cfac3c4d156eda45080c7dcdd2a4c41e08067" }, "docker/kitematic": { "ref": "docs", "repos": [ "[email protected]:docker/kitematic.git" ], "sha": "856a989d834f7fcbcb9bba687539fb159228f6b8" }, "docker/machine": { "ref": "docs", "repos": [ "[email protected]:docker/machine.git" ], "sha": "21edf30337dc5996b5d785ce54d68b4020242f57" }, "docker/notary": { "ref": "docs", "repos": [ "[email protected]:docker/notary.git" ], "sha": "dfeb51f54f2b0cdf20cb55427b7cc8ea2d1cdd0a" }, "docker/opensource": { "ref": "master", "repos": [ "[email protected]:docker/opensource.git" ], "sha": "b994cdd1f74b0aeb0b51fda1249a0c4c8efbf0d0" }, "docker/registry": { "ref": "docs", "repos": [ "[email protected]:docker/distribution.git" ], "sha": "a5bd3e61441873ba6cb40480bda58176733fedb9" }, "docker/swarm": { "ref": "docs", "repos": [ "[email protected]:docker/swarm.git" ], "sha": "b43a2c21c4017726cd9cb17ef9b16f2eef6d1159" }, "docker/toolbox": { "ref": "master", "repos": [ "[email protected]:docker/toolbox.git" ], "sha": "de267d701f94035549ea03e68047d85534286f85" }, "docker/tutorials": { "ref": "master", "repos": [ "[email protected]:docker/tutorials.git" ], "sha": "7af2622fe68a30684d971e4bf3ca7988902e5e26" }, "docker/ucp": { "ref": "docs", "repos": [ "[email protected]:docker/orca.git" ], "sha": "8cd10936a1e063b9be0d5c04de7311a1b2cb25cf" }, "docs.docker.com": { "ref": "refs/heads/v1.10-03-04-2016-165411", "repos": [ "[email protected]:moxiegirl/docs.docker.com.git", "[email protected]:docker/docs.docker.com.git" ], "sha": "5d156add0cb35c1b8f7d2dc1e08f04bd5725792b" } }