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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.