Chapter 7. Migrating from AWS EC2


Run your AWS EC2 migration plan from the MTV UI or from the command-line.

7.1. Prerequisites

  • You have planned your migration from AWS EC2.

7.2. Running a migration plan in the MTV UI

You can run a migration plan and view its progress in the Red Hat OpenShift web console.

Prerequisites

  • Valid migration plan.

Procedure

  1. In the Red Hat OpenShift web console, click Migration for Virtualization > Migration plans.

    The Plans list displays the source and target providers, the number of virtual machines (VMs) being migrated, the status, the date that the migration started, and the description of each plan.

  2. Click Start beside a migration plan to start the migration.
  3. Click Start in the confirmation window that opens.

    The plan’s Status changes to Running, and the migration’s progress is displayed.

    Warning

    Do not take a snapshot of a VM after you start a migration. Taking a snapshot after a migration starts might cause the migration to fail.

  4. Optional: Click the links in the migration’s Status to see its overall status and the status of each VM:

    • The link on the left indicates whether the migration failed, succeeded, or is ongoing. It also reports the number of VMs whose migration succeeded, failed, or was canceled.
    • The link on the right opens the Virtual machines tab of the Plan details page. For each VM, the tab displays the following data:

      • The name of the VM
      • The start and end times of the migration
      • The amount of data copied
      • A progress pipeline for the VM’s migration
  5. To view your migration’s logs, either as it is running or after it is completed:

    1. Click the Virtual machines tab.
    2. Click the arrow (>) before the name of the virtual machine whose migration progress you want to check.
    3. In the Pods section, in the Pod links column, click the Logs link.

      The Logs tab opens.

      Note

      Logs might not be available for the following common reasons:

      • The migration is from OpenShift Virtualization to OpenShift Virtualization. In this case, the virt-v2v utility is not involved, so no pod is required.
      • No pod was created.
      • The pod was deleted.
      • The migration failed before running the pod.
    4. To see the raw logs, click the Raw link.
    5. To download the logs, click the Download link.

7.2.1. Migration plan options

On the Migration plans page of the Red Hat OpenShift web console, you can click the Options menu kebab beside a migration plan to access the following options:

  • Edit Plan: Edit the details of a migration plan. If the plan is running or has completed successfully, you cannot edit the following options:

    • All properties on the Settings section of the Plan details page. For example, warm or cold migration, target namespace, and preserved static IPs.
    • The plan’s mapping on the Mappings tab.
    • The hooks listed on the Hooks tab.
  • Start migration
  • Restart migration: Restart a migration that was interrupted. Before choosing this option, make sure there are no error messages. If there are, you need to edit the plan.
  • Duplicate: Create a new migration plan with the same virtual machines (VMs), parameters, mappings, and hooks as an existing plan. You can use this feature for the following tasks:

    • Migrate VMs to a different namespace.
    • Edit an archived migration plan.
    • Edit a migration plan with a different status, for example, failed, canceled, running, critical, or ready.
  • Archive: Delete the logs, history, and metadata of a migration plan. The plan cannot be edited or restarted. It can only be viewed, duplicated, or deleted.

    Note

    Archive is irreversible. However, you can duplicate an archived plan.

  • Delete: Permanently remove a migration plan. You cannot delete a running migration plan.

    Note

    Delete is irreversible.

    Deleting a migration plan does not remove temporary resources. To remove temporary resources, archive the plan first before deleting it.

    Note

    The results of archiving and then deleting a migration plan vary by whether you created the plan and its storage and network mappings using the CLI or the UI.

    • If you created them using the UI, then the migration plan and its mappings no longer appear in the UI.
    • If you created them using the CLI, then the mappings might still appear in the UI. This is because mappings in the CLI can be used by more than one migration plan, but mappings created in the UI can only be used in one migration plan.

7.2.2. Canceling a migration

You can cancel the migration of some or all virtual machines (VMs) while a migration plan is in progress by using the Red Hat OpenShift web console.

Procedure

  1. In the Red Hat OpenShift web console, click Migration for Virtualization > Migration plans.
  2. Click the name of a running migration plan to view the migration details.
  3. Select one or more VMs and click Cancel.
  4. Click Yes, cancel to confirm the cancellation.

    In the Migration details by VM list, the status of the canceled VMs is Canceled. The unmigrated and the migrated virtual machines are not affected.

  5. Restart a canceled migration by clicking Restart beside the migration plan on the Migration plans page.

You can migrate EC2 instances to OpenShift Virtualization by using the command-line interface (CLI) to create and configure Secret, Provider, NetworkMap, StorageMap, Plan, and Migration custom resources.

Prerequisites

  • OpenShift Virtualization destination provider configured
  • EC2 instances must be stopped before migration

Procedure

  1. Create a Secret manifest for the source provider credentials:

    $ cat << EOF | oc apply -f -
    apiVersion: v1
    kind: Secret
    metadata:
      name: <secret>
      namespace: <namespace>
    type: Opaque
    stringData:
      region: <aws_region>
      accessKeyId: <aws_access_key_id>
      secretAccessKey: <aws_secret_access_key>
      # targetAccessKeyId: <target_aws_access_key_id>
      # targetSecretAccessKey: <target_aws_secret_access_key>
    EOF

    where:

    <secret>
    Specifies the name of the Secret CR.
    <namespace>
    Specifies the namespace for the resource. Use openshift-mtv for the MTV namespace, or specify a custom namespace if you have configured providers in a different project.
    <aws_region>
    Specifies the region where your EC2 instances are located, for example, us-east-1 or us-east-2.
    <aws_access_key_id>
    Specifies the access key ID for the source account.
    <aws_secret_access_key>
    Specifies the secret access key for the source account.
    <target_aws_access_key_id>
    Specifies the access key ID for the target account. Required only for cross-account migrations.
    <target_aws_secret_access_key>

    Specifies the secret access key for the target account. Required only for cross-account migrations.

    Note

    For same-account migrations, use the OpenShift cluster’s credentials to ensure the Elastic Block Store (EBS) Container Storage Interface (CSI) driver can access the migrated volumes.

  2. Create a Provider manifest for the source provider:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: Provider
    metadata:
      name: <source_provider>
      namespace: <namespace>
    spec:
      type: ec2
      secret:
        name: <secret>
        namespace: <namespace>
      settings:
        target-az: <target_availability_zone>
    EOF

    where:

    <namespace>
    Specifies the namespace for the resource. Use openshift-mtv for the MTV namespace, or specify a custom namespace if you have configured providers in a different project.
    <source_provider>
    Specifies the name of the source provider.
    <secret>
    Specifies the name of the provider Secret CR.
    <target_availability_zone>

    Specifies the target availability zone where MTV creates EBS volumes, for example, us-east-1a. This must match an availability zone where OpenShift worker nodes run.

    Important

    EBS volumes are availability zone-specific. If the target-az setting does not match an availability zone where OpenShift worker nodes run, the EBS CSI driver cannot attach the volumes to worker nodes, causing the migration to fail.

  3. Create a NetworkMap manifest to map the source and destination networks:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: NetworkMap
    metadata:
      name: <network_map>
      namespace: <namespace>
    spec:
      map:
        - destination:
            name: <network_name>
            type: pod
          source:
            id: <source_subnet_id>
        - destination:
            name: <network_attachment_definition>
            namespace: <network_attachment_definition_namespace>
            type: multus
          source:
            id: <source_subnet_id>
      provider:
        source:
          name: <source_provider>
          namespace: <namespace>
        destination:
          name: <destination_provider>
          namespace: <namespace>
    EOF

    where:

    <network_map>
    Specifies the name of the network map.
    <namespace>
    Specifies the namespace for the resource. Use openshift-mtv for the MTV namespace, or specify a custom namespace if you have configured providers in a different project.
    <source_subnet_id>
    Specifies the subnet ID (for example, subnet-abc123def456).
    type
    Specifies the network type. Allowed values are pod and multus.
    <network_attachment_definition>
    Specifies a network attachment definition (NAD) for each additional OpenShift Virtualization network.
    <network_attachment_definition_namespace>
    Specifies the namespace of the OpenShift Virtualization NAD. Required only when type is multus.
  4. Create a StorageMap manifest to map source and destination storage:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: StorageMap
    metadata:
      name: <storage_map>
      namespace: <namespace>
    spec:
      map:
        - destination:
            storageClass: <storage_class>
          source:
            id: <source_volume_type>
      provider:
        source:
          name: <source_provider>
          namespace: <namespace>
        destination:
          name: <destination_provider>
          namespace: <namespace>
    EOF

    where:

    <storage_map>
    Specifies the name of the storage map.
    <storage_class>
    Specifies the storage class that uses the EBS CSI driver. The storage class must be configured for the same availability zone as the target-az setting in the Provider resource.
    <source_volume_type>
    Specifies the EBS volume type (for example, gp2, gp3, io1).
  5. Create a Plan manifest for the migration:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: Plan
    metadata:
      name: <plan>
      namespace: <namespace>
    spec:
      provider:
        source:
          name: <source_provider>
          namespace: <namespace>
        destination:
          name: <destination_provider>
          namespace: <namespace>
      map:
        network:
          name: <network_map>
          namespace: <namespace>
        storage:
          name: <storage_map>
          namespace: <namespace>
      targetNamespace: <target_namespace>
      vms:
        - id: <source_vm1>
        - name: <source_vm2>
          hooks:
            - hook:
                namespace: <namespace>
                name: <hook>
              step: <step>
    EOF

    where:

    <namespace>
    Specifies the namespace for the resource. Use openshift-mtv for the MTV namespace, or specify a custom namespace if you have configured providers in a different project.
    <plan>
    Specifies the name of the Plan CR.
    map
    Specifies the network map and storage map used by the plan.
    network
    Specifies a network mapping, even if the migration does not assign the virtual machines (VMs) to a network. The mapping can be empty in this case.
    <network_map>
    Specifies the name of the NetworkMap CR.
    storage
    Specifies a storage mapping, even if the migration does not assign disk images to the VMs. The mapping can be empty in this case.
    <storage_map>
    Specifies the name of the StorageMap CR.
    <target_namespace>
    Specifies the target namespace in OpenShift Virtualization where MTV creates the migrated VMs.
    vms
    Specifies the source VMs. Accepts either the id or the name parameter to specify the source VMs.
    <source_vm1>
    Specifies the EC2 instance ID.
    hooks
    Specifies up to two hooks for a VM. Each hook must run during a separate migration step. This is an optional field.
    <hook>
    Specifies the name of the Hook CR.
    <step>
    Specifies the type of hook. Allowed values are PreHook, before the migration plan starts, or PostHook, after the migration is complete.
  6. Create a Migration manifest to run the Plan CR:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: Migration
    metadata:
      name: <name_of_migration_cr>
      namespace: <namespace>
    spec:
      plan:
        name: <name_of_plan_cr>
        namespace: <namespace>
    EOF

    where:

    <name_of_migration_cr>
    Specifies the name of the Migration CR.
    <name_of_plan_cr>
    Specifies the name of the Plan CR to execute.
  7. Monitor the migration progress:

    $ oc get migration/<name_of_migration_cr> -n <namespace> -o yaml

    This shows the migration status and progress.

  8. View detailed migration information:

    $ oc get vmimports -n <namespace>

    This shows the detailed phases of the VM import process.

You can use the command-line interface (CLI) to cancel either an entire migration or the migration of specific virtual machines (VMs) while a migration is in progress.

You can use the command-line interface (CLI) to cancel an entire migration while a migration is in progress.

Procedure

  • Delete the Migration CR:

    $ oc delete migration <migration> -n <namespace>

    where:

    <migration>
    Specifies the name of the Migration CR.

You can use the command-line interface (CLI) to cancel the migration of specific virtual machines (VMs) while a migration is in progress.

Procedure

  1. Add the specific VMs to the spec.cancel block of the Migration manifest, following this example:

    $ cat << EOF | oc apply -f -
    apiVersion: forklift.konveyor.io/v1beta1
    kind: Migration
    metadata:
      name: <migration>
      namespace: <namespace>
    ...
    spec:
      cancel:
      - id: vm-102
      - id: vm-203
        name: rhel8-vm
    EOF

    where:

    id or name
    Specifies a VM by using the id key or the name key.
  2. Retrieve the Migration custom resource (CR) to monitor the progress of the remaining VMs, following this example:

    $ oc get migration/<migration> -n <namespace> -o yaml
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top