Creating a Swarm Cluster in AWS

To create a Swarm cluster in AWS:
  1. Click Deploy Docker Community Edition (CE) for AWS.
  2. Click Next to create stack.

  3. Create the ssh key pair in AWS portal and save *.pem locally.

  4. Specify the stack name, number of swarm managers, worker nodes, instance type, etc. Use the key pair name(created in previous step) for Which ssh key to use.

  5. Accept the acknowledgment to create the cluster.

    Once the cluster is created, you will see a screen similar to this:

  6. Run the following command:
    chmod 400 <*.pem>
    Add the ssh key:
     ssh-add *.pem
  7. To login to the manager node, find the IP of the manager node in AWS cluster:
     ssh -A docker@x.x.81.235
    
    Make sure you are logged in to the manager node.
  8. Copy the images files into the manager node using:
     scp -i *.pem /tml*.* docker@x.x.81.235:/home/docker


  9. Login into the manager node and load all the images:
     ssh -A docker@x.x.81.235


  10. Once the images are being loaded in the master node, ssh into the each of the worker nodes and scp the images, and load all the images in the worker node as well:

  11. Untar the tar -xvf tml-deploy.tgz:
    ./compose.sh manifest-aws-swarm.json
    
    TML_CLUSTER_NAME: Tibco Mashery Local Reference Cluster
    TML_CLUSTER_TAG: 169520f85a36e474ea1b06d4c87e111d
    TML_ZONE_NAME 0: local
    TML_ZONE_COUNT: 1
    TML_RELEASE_VERSION: 5.0.0
  12. List the nodes:
    docker node ls
    
    ID                            HOSTNAME                                      STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
    
    hee56t3jntdm6tfv10y02vpyo *   ip-x-x-0-125.us-west-2.compute.internal    Ready               Active              Leader              18.06.1-ce
    46uy8lpt1iwyg29j5irft2vc5     ip-x-x-35-149.us-west-2.compute.internal   Ready               Active                                  18.06.1-ce
    
  13. If the swarm cluster is created successfully, create an Overlay network ml5 for the containers networking. Execute the following command on the manager node:
    docker network create -d overlay --attachable ml5
  14. Create the cluster:

  15. Once it is complete, to check which nodes got deployed on Master/slave use:
    docker ps
  16. To login to any pod inside node:
    ssh docker@master-ip

    docker ps, use docker exec to get into the pod.

    Ensure that all the pods are ACTIVE.