AWS Cloud Operations Blog

How to Skip Testing and Finalize Cutover in the AWS Application Migration Service

Introduction

The purpose of this blog post is to show the steps on how to change the lifecycle status of a source server from “Ready for testing” to “Ready for cutover” to bypass the testing steps when using the AWS Application Migration Service (MGN). This approach can be used for specific scenarios where you want to skip testing, an example could be building a proof of concept or a lower environment where a directory service is used. Creating a testing environment might cause users to be redirected to the testing instances rather than the original server. This would lead to an unintended redirection of users to a migrated workload during the testing phase.

Migrating workloads to the cloud may incur system downtime or service interruptions. Moreover, there is a need to test the migrated workloads before cutover and subsequently directing users and systems to the migrated workloads. The AWS Application Migration Service (MGN) is a solution designed to minimize these risks. The Application Migration Service provides the capability to manage VM workload migration through different steps within its lifecycle. This traditionally includes a set of testing phase steps followed by a set of cutover phase steps as shown in Figure 1.

Application Migration Service lifecycleFigure 1 – AWS MGN Lifecycle

Prerequisites

Before proceeding to modify the migration lifecycle, perform the following:

  1. Install the AWS CLI v2 on your local machine. Follow the instructions to install or update the CLI. If you have the current CLI v1, please proceed with an update then continue the steps. An alternative to using your local machine, you can install an EC2 instance and use the CLI from within. For this guide I will stick with the local machine CLI.
  2. Set up the AWS CLI to configure the IAM user for programmatic access. As an alternative, you can use temporary credentials to configure access.
  3. Check that your source server to be migrated is available in the Application Migration Service console as shown in Figure 2. Source servers are added to MGN by installing the replication agent on source machines or through the MGN vCenter Client in case of migrating VMWare machines.
  4. The source server has to be fully replicated and in a launchable state with a migration lifecycle status of “Ready for testing”.

Source servers list in AWS MGN ConsoleFigure 2 – Source servers list in AWS MGN Console

For detailed steps check the: Application Migration Service Quick start guide.

Solution

Use the Application Migration Service mgn change-server-lifecycle-state API from the AWS CLI to update the lifecycle of a source server. This allows you to set the SourceServer.LifeCycle.state property for a specific source server to one of the following:

  1. READY_FOR_TEST
  2. READY_FOR_CUTOVER
  3. CUTOVER

In this case, set the value to “READY_FOR_CUTOVER”.
Here we will obtain the AWS ID from the server info as it is used as the server identifier parameter when running the CLI command.

  1. In the Application Migration Service menu pane select Source servers then select the Source server name to show server details as in Figure 3.

    Select server from source servers listFigure 3 – Select server from source servers list

  2. Select the Server info tab and capture the AWS ID. This value will be used in the next steps as in Figure 4.

    Capture AWS IDFigure 4 – Capture AWS ID

Switch to your local machine CLI. From the CLI run the following AWS CLI command:

$ aws mgn change-server-life-cycle-state --source-server-id <AWS ID> --life-cycle {"\state\":\"READY_FOR_CUTOVER\"}
  1. Replace the <AWS ID> tag with the value captured previously. For the life-cycle parameter set the JSON value for state to READY_FOR_CUTOVER.
  2. The lifecycle JSON may require an escape character (\) prior to each double quote based on your operating system. In this example, running on a Mac uses the escape character.
  3. The CLI command will run and show the steps towards changing the status and when finished will show a success message as shown in Figure 5.

    Changing status stepsFigure 5 – Changing status steps

Now that we switched the lifecycle state, let’s continue migration to cutover

    1. Switch to the browser and select the Migration Dashboard tab. Notice that the lifecycle status is now showing “Ready for cutover”.
    2. Select the Replication menu then select Launch cutover instances as shown in Figure 6.

      Launch cutover instancesFigure 6 – Launch cutover instances

    3. Notice the launch process is now activated and a confirmation message appears. Choose the Launch button as in Figure 7.

      Launch cutover instance confirmationFigure 7 – Launch cutover instance confirmation

    4. Now the cutover server creation starts and the lifecycle is set to Cutover in progress as in Figure 8.

      Status is set to Cutover in progressFigure 8 – Status is set to Cutover in progress

This shows that MGN cutover environment is ready and available to use without going through the MGN testing phase.

Clean up

To avoid accruing any additional charges related to the setup explained in this post, be sure to clean up your resources, including:

  • Amazon EC2 Instances
  • Disconnect any MGN Source Servers creating for the purpose of this post.
  • Any EBS volumes attached to the EC2 instances associated with your testing

Conclusion

This blog post showed the procedure for transitioning the status of a source server from “Ready for testing” to “Ready for cutover” utilizing the AWS Command Line Interface (CLI) MGN API. This shows how to bypass the testing phase and expedite the server’s transition to the cutover state.
Note: As a best practice, follow Application Migration Service (MGN) standard Lifecycle policy with Testing included. Skipping testing may result in unexpected behavior. Use this process only for select scenarios.

Mohamad Charaf

Mohamad Charaf is Senior Solutions Architect with the World-Wide Public Sector at AWS. With a migrations and modernization focus and a passion for guiding organizations to bridge the gap towards successful cloud migrations, he excels at providing solutions and approaches to simplify the path to migrations.