Migrating On-Premises Workloads to EC2: A Technical Guide

Migrating on-premises workloads to Amazon Elastic Compute Cloud (EC2) can be a complex process, but with the right tools and strategies, it can be simplified and expedited. In this guide, we will walk through the technical steps involved in migrating a content management system (CMS) platform, using WordPress as an example, from a simulated on-premises environment to AWS Cloud using AWS Application Migration Service (MGN).

Prerequisites

Before starting the migration process, ensure you have:

  • An AWS account

  • A clear understanding of Amazon Virtual Private Cloud (Amazon VPC)

  • Created the virtual networking environment

    • Create Amazon VPC, MGN-Demo VPC

    • Create three subnets in the MGN-Demo VPC: Staging Area Subnet, Migrated Resources Public Subnet, and Migrated Resource Private Subnet

    • Create Internet gateway and attach it to the MGN-Demo VPC

    • Create two Route tables: Public-MGN-Demo-RouteTable and Private-MGN-Demo-RouteTable

    • Add internet route to the Public-MGN-Demo-RouteTable (Destination 0.0.0.0/0 with Internet gateway as target)

    • Associate the Staging Area Subnet and Migrated Resources Public Subnet with the Public-MGN-Demo-RouteTable

    • Associate the Migrated resource private subnet with the Private-MGN-Demo-RouteTable

    • Launch an Amazon EC2 instance as a Bastion host in the Migrated Resources Public Subnet

    • Create two security groups: Public-MGN-Demo-SG and Private-MGN-Demo-SG

    • Add inbound rules for HTTP and HTTPS ports from anywhere (0.0.0.0/0), and SSH port from the Bastion host public IP address to the Public-MGN-Demo-SG

    • Add inbound rules for MYSQL ports from Public-MGN-Demo-SG security group to the Private-MGN-Demo-SG and SSH port from the Bastion host public IP address

Migration Process

The key steps of this migration process are:

  1. Create IAM user for AWS Replication Agent
aws iam create-user --user-name aws-replication-agent
  1. Create the Replication Settings template in the AWS MGN Console
aws mgn create-replication-settings --template-name wordpress-replication-settings
  1. Install the AWS Replication Agents on source servers
sudo apt-get update && sudo apt-get install -y aws-replication-agent
  1. Configure the Launch Settings in the AWS MGN console
aws mgn configure-launch-settings --launch-settings-name wordpress-launch-settings
  1. Launch the test instances
aws mgn launch-test-instances --test-instance-name wordpress-test-instance
  1. Launch the cutover instances
aws mgn launch-cutover-instances --cutover-instance-name wordpress-cutover-instance
  1. Finalize cutover
aws mgn finalize-cutover --cutover-instance-name wordpress-cutover-instance

Conclusion

Migrating on-premises workloads to EC2 using AWS Application Migration Service (MGN) simplifies and expedites the process, reducing the cost and complexity of migrating applications to AWS. By following these technical steps, you can successfully migrate your CMS platform from a simulated on-premises environment to AWS Cloud.