Cluster manager with RDS, Autoscale and Elastic IP

Overview

This article describes a process for provisioning your Cluster Manager within the Amazon Autoscale service. This deployment is relevant for organizations that want to add some robustness to their Cluster Manager deployment. The AWS Autoscale service is capable of monitoring a single instance, and if that instance should be deleted, a new instance will be launched. Here is a diagram of the solution.

Cluster Manager with Autoscale.png

 

Note: This article covers a single instance of Cluster Manager running in AWS Autoscale group.

Prerequisites

  1. You have a subscription to Aspera On Demand Cluster Manager.
  2. You are familiar with the AWS services:  S3, Autoscale, RDS, Route53, Elastic IP, IAM role
  3. You have provisioned your Cluster Manager as per the setup instructions with RDS
  4. You have obtained an Elastic IP (EIP) for your Cluster Manager instance
  5. You can ssh to your Cluster manager instance, using your ssh key
  6. You have an Access Key and Secret for use with your instance
  7. (Optional - but recommended) You have a hostname for your Cluster Manager that is registered in DNS pointing to your EIP
  8. (Optional - but recommended) You have a SSL certificate for your Cluster Manager hostname.

Procedure - Overview

  1. Configure Cluster Manager to have an Elastic IP
  2. Prepare and create a new image of your Cluster Manager
  3. Configure ELB and Route 53
  4. Configure a new Autoscale group and launch configuration for the new image

Procedure - details

  1. Launch a new Cluster manager with the firstboot disabled
    1. Follow the normal launch procedure, but provide the following in your user data field:
      "firstboot=disabled"
  2. Configure Cluster Manager to have an Elastic IP (EIP)
    1. Upon system reboot, it is required that Cluster Manager be auto assigned the same EIP. As of the time of this article, the AWS Autoscale system can not auto assign an EIP to members of the autoscale group, therefore we need to employ a custom utility. Fortunately someone has solved this problem and posted the solution. The steps are documented below.
    2. Login via SSH to your Cluster Manager system and sudo to root.  Install the aws-ec2-assign-elastic-ip utility:
      # curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
      # python get-pip.py
      # pip install aws-ec2-assign-elastic-ip
    3. Test the utility with your EIP, Access key and Secret, for example:
      aws-ec2-assign-elastic-ip --region us-west1 --secret-key FQkJs8uwSYijGcy4/IawBr0FsRCr8tPb3nDkCoFe --access-key ALIWIUKNOGS43OELHMTA --valid-ips 54.221.36.9
    4. Create an init script that will run each time the system is booted.  The script should be created here: /opt/aspera/firstboot/firstboot.d/11-auto-assign-eip.sh. Note: Please substitute your secret, access key and EIP.
      #!/bin/bash
      aws-ec2-assign-elastic-ip --region us-west1 --secret-key FQkJs8uwSYijGcy4/IawBr0FsRCr8tPb3nDkCoFe --access-key ALIWIUKNOGS43OELHMTA --valid-ips 54.221.36.9
    5. Change the permissions on 11-auto-assign-eip.sh so that it is executable:
      chmod 755 /opt/aspera/firstboot/firstboot.d/11-auto-assign-eip.sh
    6. Delete the instance data and firstboot directory
      rm -rf /opt/aspera/firstboot/instance.data
      rm -rf /opt/aspera/firstboot/firstboot/
  3. Create a new image of your Cluster Manager
    1. Login to your AWS console, navigate to the EC2 > Images, select your running Cluster Manager image and from the ACTIONS menu, select Image > Create Image.
    2. Make a note of the new image AMI ID
  4. Create an Elastic Load Balancer and Route 53 entries for your Cluster Manager. 
    • For details on creating Route 53 entries, please see this.
    • For details on creating Elastic Load Balancers, please see this.
    • NOTE: Ensure that Port 80 (HTTP) forwards to Port 80 and that Port 443 (HTTPS) forwards to Port 443.
    • It is not necessary to add EC2 instances at this point. We will do this when we create an Autoscaling group in step 4.
  5. Configure a Launch configuration and Autoscale group
    1. Login to the AWS console, and navigate to the EC2 > Autoscale > Launch configuration.
    2. Click on Create new Launch configuration.
    3. Navigate to My AMI's and select the newly created AMI, click next.
    4. Select the Instance type (e.g. m3-medium) and click next.
    5. Specify the configuration details (e.g. IAM Role and Name) and click next.
    6. Select Advanced and add the following script into the userdata section. Adjust the script to your EIP, Access Key, Secret and region:
      {
      "restore": true,
      "database": {
      "host": "YOUR_RDS_SERVER.rds.amazonaws.com",
      "port": 3306,
      "user": "LOGIN",
      "password": "PASSWORD"
      }
      }
    7. Confirm that the storage space meets your requirement and click next.
    8. Specify the security group that provides sufficient access (e.g. HTTP(s) and TCP/UDP 33001)
    9. Review the configuration options and select an ssh key required to access the system.
    10. At this point, you have a launch configuration and you need to create the Autoscaling group.
    11. Create a new Autoscaling group, specify a name for your group.  
    12. Leave the default of 1 instance for this group (note;  multiple instances will not work).
    13. Specify the subnet that you are running your instance in.
    14. Specify an availability zone for your instance.
    15. Under Advanced Details, place a check next to "Receive traffic from Elastic Load Balancer(s)". Enter the name of your ELB that you will be using.
    16. (Optional) Under Advanced Details, specify a custom health check grace period.
    17. (Optional) Create an autoscaling group notification and click next.
    18. (Optional - but suggested) Create a tag for your auto scaling group.
    19. Review all configured options and save the auto scaling group.

At this point, the AWS Autoscale group should launch an instance according to your specification.  You can view the running instance in your EC2 instances.  If nothing is there, please navigate back to the Autoscale Group configuration and review the Activity History and Instances for more information.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk