Migrate from RDS MySQL to Aurora MySQL in near zero downtime
Introduction
Implementation
Setup web application
1. Download the CloudFormation template
The CloudFormation.yaml Template on the GitHub page will launch an Amazon EC2 instance of type t2.micro with latest Amazon Linux 2 OS, bootstrap Apache/PHP, and install a simple address book web application. The template will also create an Amazon RDS MySQL database instance in free tier, i.e. of type db.t2.micro and with no Multi-AZ setup or read replicas. The WebTier Security Group will allow only SSH and HTTP connections to the web server (EC2 instance), and the DBTier Security Group will only allow the WebTier Security Group to initiate database connections to the RDS DB instance over the TCP port 3306.
Go to the Github link and download the files as shown.
Click the Code option and then click on Download ZIP. The zip folder will be downloaded by your browser.
Go to the downloaded folder location on your machine and then unzip the folder. You will have all files as shown above.

2. Open CloudFormation
Open the AWS CloudFormation console and sign in with your AWS account credentials. Choose the Region drop-down and select the appropriate AWS Region. This tutorial uses the US West (Oregon) Region. Click on Create stack.

3. Create stack
Select Template is ready, and choose Upload a template file as the source template. Then, click on Choose file and upload the CloudFormation.yaml (downloaded in previous step). Click Next.

4. Review stack details and create stack
Populate the form as with the values specified below, and then click Next:
Stack Name: A unique identifier without spaces
DBInstanceID: RDS DB instance identifier. It defaults to rdsdb
DatabaseName: Database name. It defaults to mydb
KeyName: The existing key pair in this account and region
LatestAmild: Don't change this parameter, it will install the latest Amazon Linux 2 OS AMI
MasterUsername: Choose subnet to deploy the instances
MasterPassword: Password for MySQL database access
SubnetID: Choose subnet to deploy the instances
VPC: Choose VPC (Above subnet should be of this VPC)
Note: The resources that are created here will be prefixed with whatever value you specify in the Stack Name. Please specify a value that is unique to your account.
Once you click Next, on the Stack Options page, accept all of the defaults and click Next.
On the Review page, click Create stack.

5. Wait for stack creation
At this point, you will be directed back to the CloudFormation console and will see a status of CREATE_IN_PROGRESS. Please wait here until the status changes to COMPLETE.

6. (Optional) Refresh status
You can click on the refresh icon to see the progress of resources creation.

7. View stack outputs
Once CloudFormation status changes to CREATE_COMPLETE, go to the Outputs section.
Make a note of the Output values from the CloudFormation environment that you have launched, as you will need them for the remainder of the lab.
For this tutorial setup, the values are:
RDS DB instance endpoint - rdsdb.cp94ll5qcjxh.us-west-2.rds.amazonaws.com
This is the DNS name of your database instance, and you will need it to connect to the database.
Webserver URL - http://ec2-35-165-91-1.us-west-2.compute.amazonaws.com/
This is the Public DNS name of the Amazon EC2 instance.

8. Open web application and choose RDS
Open a new browser tab and navigate to the web server interface by entering the EC2 instance’s Public DNS name (from preceding step) into the browser. You should see a website that looks like the example.
Click on the RDS tab.

9. Enter database details
Enter the credentials and database name as shown. The RDS Endpoint name was noted in previous step Click the Submit button.

10. Verify connection and view configuration file
You will see a brief message of a connection attempt by the application to connect to the database on the RDS DB instance, as shown.
You will review the contents of file rds.conf.php

11. View address book
Upon successful connection completion, you will be redirected to a simple address book application displaying all of the information from the database.

12. (Optional) Test database operations
Feel free to play around with the address book and add/edit/remove content from your RDS database by using the Add Contact, Edit, and Remove links in the Address Book. The changes made to the address book in this tutorial are shown.

13. Connect to Instance
Navigate to the EC2 console, choose the EC2 instance (Webserver) and choose Connect.

14. Choose a connection method
In the Connect to your instance dialog box, choose EC2 Instance Connect (browser-based SSH connection) and then choose Connect. A browser window opens displaying the EC2 instance command line interface (CLI).
