Setting up a Swarm cluster with Docker for AWS

Before we create a Swarm cluster using Docker for AWS, we'll need to generate a Key Pair that we'll use to SSH into the EC2 instances.

To create a new key-pair, please execute the command that follows:

aws ec2 create-key-pair \    --key-name devops21 \    | jq -r '.KeyMaterial' >devops21.pem

We executed aws ec2 create-key-pair command and passed devops21 as the name. The output was filtered with jq so that only the actual value is returned. Finally, we sent the output to the devops21.pem file.

If someone gets a hold of your key file, your instances would be exposed. Therefore, we should move the key somewhere safe.

A common location for SSH keys on Linux/OSX systems is $HOME/.ssh. If you are a Windows ...

Get The DevOps 2.1 Toolkit: Docker Swarm now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.