Spotinst Radius creates a standby instance and synchronously replicates the primary DB data to a different Availability Zone. Radius is currently only available for a multi-az RDS configuration for MySQL version 5.6 and above.
1.0 Update Spotinst Policy
Login to your AWS console and go to IAM console
Open Spotinst policy and click Edit
Add the below permissions:
"rds:DescribeDBInstances", "rds:DescribeDBParameterGroups", "rds:DescribeDBParameters", "ec2:AllocateAddress", "ec2:ReleaseAddress", "lambda:InvokeFunction", "lambda:ListFunctions", "rds:DescribeDBInstances", "rds:DescribeDBParameterGroups", "rds:DescribeDBParameters", "ec2:AllocateAddress", "ec2:ReleaseAddress", "route53:CreateHostedZone", "route53:DeleteHostedZone", "route53:ListHostedZones", "route53:ChangeResourceRecordSets"
2.0 Create DB User
Create a user in your Master RDS with the following permissions:
CREATE USER 'USER_NAME'@'%' IDENTIFIED BY 'PASSOWRD'; GRANT EXECUTE, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'USER_NAME'@'%' IDENTIFIED BY 'PASSOWRD'; FLUSH privileges;
Please make sure that the user is open (and not private). MySQL syntax info can be found here: http://dev.mysql.com/doc/refman/5.7/en/grant.html
3.0 Create Read Replica
In order for Spotinst to replicate the data, you need to create a Read Replica instance from which we will copy the data.
- Login to AWS console and go to RDS console
- Click on the Master RDS you want to migrate to Radius
- Click on “Instance Actions” -> “Create Read Replica”
4.0 Configure Security Groups
Need to configure new security groups or modify an existing one to allow access between Radius to your RDS instances.
For RDS in public subnet:
- Security Group setting for Radius slave instance:
- Inbound :
The inbound rule need to allow access only to your DB port. For example:
- Inbound :
- Security Group setting for your RDS Master instance:
The inbound rule needs to allow access only to your DB port. For example:
For RDS in private subnet:
- Create a new security group without rules:
- Add an inbound rule only for this security group:
Make sure that the security group in open to port 22 so that you will be able to SSH to the instance.
- Add the security group you just created to the Master RDS.
4.1 – For private subnet RDS only:
Launch the cloudformation stack.
This cloudformation will allow us to communicate with the EC2 instance.
- Login to AWS cloudforamtion and create a new stack:
- Select cloudformation template: Paste this URL:
- Click next and specify your RDS details. In security groups insert the group you created in step 4 and click next.
- Add tags (if needed) and click next.
- Make sure that the checkbox “I acknowledge that AWS cloudformation might create IAM resources”. Click ‘create’.
5.0 Generate API token
- Click on the ellipses at the top right of the Spotinst console and click on “Settings”
- Click on “API Zone” at the top of the screen
- Click on “API Tokens” and click on Generate to generate a new token. Provide a descriptive name like “radius token” and save the token string somewhere safe.
6.0 Create Radius!
- From your Spotinst console main screen, click on “Radius”
- Click “Create“
- Step 1: Validate
- Choose the Region of your RDS instance
- Choose your VPC
- Select RDS Master name from the drop-down list
- Select Read-replica
- Enter the username and password you for the DB user you just created in step 2.0
- For Private subnet only – select the Proxy type: Lambda and the function name
- Click “Validate” – Radius will validate the DB engine, existence of a read replica, connectivity to the master, and DB permissions
- Step 2: Configure
- Name of the Radius
- On-Demand instance type (we will use this instance type in case Spot is not available)
- Spot instance type (you can choose multiple instance types. Out of them Radius will choose the best market to launch)
- Choose your instance Key pair
- Select the Availability Zones and subnets
- Enter the personal access token from step 5
- Step 3: Launch
In the last step of the wizard, click on “Launch” to create your Radius instance. You can follow the creation process to make sure all resources are being created successfully. In the case of a failure, you will see the exact error message and try you launch the Radius again.
7.0 Replicate Data
Now that you have your Radius instance live and running, we need to replicate and copy the data from the Read Replica instance
- SSH to your Radius instance
Enter Master RDS User password
8.0 Connecting to your Radius Instance