DEV Community

Cansu Tekin
Cansu Tekin

Posted on

Migration of a Workload running in a Corporate Data Center to AWS using the Amazon EC2 and RDS service

In another project based on a real-world scenario, I acted as the Cloud Specialist responsible for migrating a workload running in a Corporate Data Center to AWS.
The application and database were migrated to AWS using the Lift & Shift (rehost) model, moving both application and database data.

Migration steps:

  1. Planning: sizing, prerequisites, resource naming

  2. Implementation: resource provisioning, best practices

  3. Go-live: validation test — Dry-run, final migration — Cutover

  4. Post Go-live: ensuring the operation of the application and user access

  1. Planning

The client provided information and files for the application and the database to migrate from the on-premise environment to the AWS cloud.

Python Web — Wiki Server Application: Prerequisite python packages and libraries for the application to be run successfully on the AWS EC2 application server are determined.

MySQL 5.7 Python Web — Wiki DB Server: Size, host/server name, IP address, CPU, and necessary description are provided to migrate it to the Amazon RDB server.

  1. Implementation
  • Create a VPC (Amazon Virtual Private Cloud): The purpose is to build a virtual and isolated network. The accessibility of the Amazon RDB and EC2 instance resources on the Internet will be controlled by the assignment of IP addresses. One public subset and two private subsets were added to VCP. The IPv4 CIDR block must not overlap with any existing CIDR block that’s associated with the VPC.

  • Create an Internet Gateway and attach it to a VPC: Necessary for the connection between EC2 and the Internet.

Internet Gateway

Attach Internet Gateway to VPC

  • Create a Route Table: There is already an attached route table to VPC when it is created but it is local and only routing internal traffics. We want to add new traffics to allow users coming from the Internet to access the EC2 application instance. The EC2 instance also can initiate internet connections from itself like connection to download packages etc.

  • Create an EC2 instance with a new Security Group and Key Pair (.pem): EC2 instance(AMI: Ubuntu 18.04) within the previously launched VPC network was created.

  • Key pair was created while creating the EC2 instance and downloaded to the desktop. It is necessary to connect remotely to the EC2 instance from the desktop via ssh.

  • Security Group was created and configured to open a port so that we can access the services running on the virtual machine. A new security rule was added for the application to be accessed over the internet only port 8080.

  • Create MySQL RDS instance: It should be the same version from the on-promises environment or a newer version but we need to make sure this change will not affect anything else. Public access: No, never set it to “yes” if it is not really necessary.

  • Pre-requisites steps: It should be connected to the EC2 instance using ssh and pair-key which was downloaded before in “.pem” format. It is important to prepare the EC2 instance to make the application work properly on it. Required python packages and libraries were installed as determined in the planning step.

  • Set the permissions of your private key so that only you can read it. chmod 400 key-pair-name.pem

  1. On-Live

This is broken into two steps, the validation (dry run) and the cutover.

Validation(dry-run):

The on-premises resources should be up and running at this stage. Once the validation is completed successfully, a downtime window can be scheduled when the business is not running and run the final migration switching from the on-premise environment to the cloud (cutover).

  • 1) Database and 2) application deployment resources from the on-premises environment were exported and 3) put in an AWS S3 bucket. Then we can transfer files from the S3 bucket to related subnets in VCP. It is connected to the EC2 instance and opened remote connectivity from the local computer.

  • 4) The application deployment files were imported to the EC2 instance.

$ ssh ubuntu@ -i

  • 5) Remotely Connected to MySQL running on AWS RDS so that we can import the data coming from the on-premise DB. DB files were imported to the AWS RDB. 6) The connectivity between the EC2 instance and RDB was established in the application configuration file by pointing to the AWS RDB hostname.

Create a Database named wikidb in MySQL running on AWS RDS

  • A new user wiki in the wikidb was created so that application can go ahead and connect to the database, it will do connectivity from the application to the database.

Create a new user in the wikidb

  • Unzip the app files, it is configuration files from the application that we want to point to MySQL DB running on AWS.

Application configuration to point to MySQL DB running on AWS

  • Launch the application to validate the migration: Bring up the application to see if the application will be connected to the RDS.

:8080

  • A new article was created to see if the application is able to not only read from MySQL database but also write on it.

Cutover: It is the next step of the On-Live process. So, in a production environment, we can schedule the downtime to bring the actual data from the on-premises environment, import the data, and make sure that the on-premises database and application are down. Once it is done we can switch from the on-premises environment to the AWS completely.

  1. Post Go-Live:

Last step of migration. We should make sure there is no problem after go-live. Stability, ongoing support; access, performance, integration. Ongoing support can continue for 2 weeks, more or less depending on the complexity of the application.

Top comments (0)