# Migrating to Yandex Cloud with Hystax Acura

You can use Hystax Acura to migrate your cloud infrastructure to Yandex Cloud from another platform. To do so, you will need to create a Hystax Acura VM in your cloud. This VM will manage the migration process, while another VM running Hystax Acura Cloud Agent will migrate your third-party platform VMs to your cloud. Before the migration starts, the system will create VM replicas for infrastructure deployment during the migration process.

To perform the migration:
1. [Get your cloud ready](#before-begin).
1. [Create a service account and authorized key](#create-sa).
1. [Configure the network traffic permissions](#network-settings).
1. [Create a VM with Hystax Acura](#create-acura-vm).
1. [Configure Hystax Acura](#setup-hystax-acura).
1. [Prepare the Hystax Acura Cloud Agent](#prepare-agent).
1. [Create VM replicas](#create-replicas).
1. [Create a migration plan](#prepare-migration-plan).
1. [Start migration](#start-migration).

If you no longer need the resources you created, [delete them](#clear-out).

## Get your cloud ready {#before-begin}

Sign up for Yandex Cloud and create a [billing account](../../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../billing/quickstart/index.md) and [link](../../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../../resource-manager/concepts/resources-hierarchy.md).

### Required paid resources {#paid-resources}

{% note info %}

Note that both the infrastructure for Hystax Acura and the cloud agent as well as all migrated VMs will be charged and counted against the [quotas](https://console.yandex.cloud/cloud?section=quotas).
* A VM for Hystax Acura uses 8 vCPUs, 16 GB of RAM, and a 200-GB disk.
* A Hystax Acura Cloud Agent VM uses 2 vCPUs, 4 GB of RAM, and an 8-GB disk.

{% endnote %}

The cost of resources for Hystax Acura Migration includes:
* Fee for disks and continuously running VMs (see [Yandex Compute Cloud pricing](../../compute/pricing.md)).
* Fee for storing images (see [Compute Cloud pricing](../../compute/pricing.md)).
* Fee for a dynamic or static public IP address (see [Yandex Virtual Private Cloud pricing](../../vpc/pricing.md)).
* Fee for each completed migration (see [product description](https://yandex.cloud/en/marketplace/products/hystax/hystax-acura-live-cloud-migration) in Cloud Marketplace).

## Create a service account and authorized key {#create-sa}

Hystax Acura Migration will run under a [service account](../../iam/concepts/users/service-accounts.md):
1. [Create](../../iam/operations/sa/create.md) a service account named `hystax-acura-account` with the `editor` and `marketplace.meteringAgent` roles.
1. [Create](../../iam/operations/authentication/manage-authorized-keys.md#create-authorized-key) an authorized key for the service account.

Save the following details to use at the next steps:
1. Service account ID.
1. Service account authorized key ID.
1. Service account private authorized key.

## Configure the network traffic permissions {#network-settings}

Configure the network traffic permissions in the [default security group](../../vpc/concepts/security-groups.md#default-security-group). If it is unavailable, any inbound or outbound VM traffic will be allowed.

If a security group is available, [add](../../vpc/operations/security-group-add-rule.md) the following rules to it:

Traffic<br>direction | Description | Port range | Protocol | Source /<br/>Destination name | CIDR blocks
--- | --- | --- | --- | --- | ---
Inbound | `http` | `80` | `TCP` | `CIDR` | `0.0.0.0/0`
Inbound | `https` | `443` | `TCP` | `CIDR` | `0.0.0.0/0`
Inbound | `https` | `4443` | `TCP` | `CIDR` | `0.0.0.0/0`
Inbound | `vmware` | `902` | `TCP` | `CIDR` | `0.0.0.0/0`
Inbound | `vmware` | `902` | `UDP` | `CIDR` | `0.0.0.0/0`
Inbound | `iSCSI` | `3260` | `TCP` | `CIDR` | `0.0.0.0/0`
Inbound | `udp` | `12201` | `UDP` | `CIDR` | `0.0.0.0/0`
Inbound | `tcp` | `15000` | `TCP` | `CIDR` | `0.0.0.0/0`
Outbound | `http` | `80` | `TCP` | `CIDR` | `0.0.0.0/0`
Outbound | `https` | `443` | `TCP` | `CIDR` | `0.0.0.0/0`
Outbound | `vmware` | `902` | `TCP` | `CIDR` | `0.0.0.0/0`
Outbound | `vmware` | `902` | `UDP` | `CIDR` | `0.0.0.0/0`
Outbound | `iSCSI` | `3260` | `TCP` | `CIDR` | `0.0.0.0/0`
Outbound | `udp` | `12201` | `UDP` | `CIDR` | `0.0.0.0/0`

Save the security group ID. You will need it when creating the Hystax Acura VM.

## Create a VM with Hystax Acura {#create-acura-vm}

Create a VM with a boot disk from the [Hystax Acura Migration in Yandex Cloud](https://yandex.cloud/en/marketplace/products/hystax/hystax-acura-live-cloud-migration) image:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to create your VM.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/server.svg) **Virtual machines**.
  1. Click **Create virtual machine**.
  1. Under **Boot disk image**:

      * Navigate to the **Marketplace** tab.
      * Click **Show all Marketplace products**.
      * In the list of public images, select [Hystax Acura Migration in Yandex Cloud](https://yandex.cloud/en/marketplace/products/hystax/hystax-acura-live-cloud-migration) and click **Use**.

  1. Under **Location**, select an [availability zone](../../overview/concepts/geo-scope.md) where your VM will reside.
  1. Under **Disks and file storages**, enter `200 GB` as the boot [disk](../../compute/concepts/disk.md) size.
  1. Under **Computing resources**, select the `8 vCPU` and `16 GB` configuration.
  1. Under **Network settings**: 

      * In the **Subnet** field, enter the ID of a subnet in the new VM’s availability zone. Alternatively, select a [cloud network](../../vpc/concepts/network.md#network) from the list.

          * Each network must have at least one [subnet](../../vpc/concepts/network.md#subnet). If there is no subnet, create one by selecting **Create subnet**.
          * If there are no networks in the list, click **Create network** to create one:

              * In the window that opens, specify the network name and select the folder where it will be created.
              * Optionally, enable the **Create subnets** setting to automatically create subnets in all availability zones.
              * Click **Create network**.

      * If the list of **Security groups** is available, select the [security group](../../vpc/concepts/security-groups.md#default-security-group) whose network traffic permissions you previously configured. If this list is not there, the system will allow all inbound and outbound traffic for the VM.

  1. Under **Access**, select **SSH key** and specify the VM access credentials:

      * In the **Login** field, enter a username, e.g., `yc-user`.
      * In the **SSH key** field, select the SSH key saved in your [organization user](../../organization/concepts/membership.md) profile.
        
        If there are no SSH keys in your profile or you want to add a new key:
        
        1. Click **Add key**.
        1. Enter a name for the SSH key.
        1. Select one of the following:
        
            * `Enter manually`: Paste the contents of the public SSH key. You need to [create](../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) an SSH key pair on your own.
            * `Load from file`: Upload the public part of the SSH key. You need to create an SSH key pair on your own.
            * `Generate key`: Automatically create an SSH key pair.
            
              When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the `/home/<user_name>/.ssh` directory. In Windows, unpack the archive to the `C:\Users\<user_name>/.ssh` directory. You do not need additionally enter the public key in the management console.
        
        1. Click **Add**.
        
        The system will add the SSH key to your organization user profile. If the organization has [disabled](../../organization/operations/os-login-access.md) the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.

  1. Under **General information**, specify the VM name: `hystax-acura-vm`.
  1. Under **Additional**, select `hystax-acura-account`, the service account you created earlier.
  1. Click **Create VM**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

   In the terminal, run this command:

   ```bash
   yc compute instance create \
     --name hystax-acura-vm \
     --zone <availability_zone> \
     --cores 8 \
     --memory 16 \
     --network-interface subnet-id=<subnet_ID>,nat-ip-version=ipv4,security-group-ids=<security_group_ID_if_group_set_up_previously> \
     --create-boot-disk name=hystax-acura-disk,size=200,image-id=<Hystax_Acura_image_ID> \
     --service-account-id <service_account_ID> \
     --ssh-key ~/.ssh/id_ed25519.pub
   ```

   Where:

   * `name`: VM name, e.g., `hystax-acura-vm`.
   * `zone`: [Availability zone](../../overview/concepts/geo-scope.md), e.g., `ru-central1-a`.
   * `cores`: [Number of vCPUs](../../compute/concepts/vm.md) the VM has.
   * `memory`: VM [RAM size](../../compute/concepts/vm.md).
   * `network-interface`: VM network interface description:
     * `subnet-id`: Subnet to connect your VM to.

       You can get the list of subnets using the `yc vpc subnet list` CLI command.
     * `nat-ip-version=ipv4`: Connect a public IP address.
     * `security-group-ids`: Security groups.

       You can get the list of groups using the `yc vpc security-group list` command. If you skip this parameter the system will assign the [default security group](../../vpc/concepts/security-groups.md#default-security-group).
   * `create-boot-disk`: Create a new disk for the VM:
     * `name`: Disk name, e.g., `hystax-acura-disk`.
     * `size`: Disk size.
     * `image-id`: Disk image ID.

        For this example, use `image_id` from the [product description](https://yandex.cloud/en/marketplace/products/hystax/hystax-acura-live-cloud-migration) in Cloud Marketplace.

   * `service-account-id`: ID of the service account you [created previously](#create-sa).

     You can get the list of accounts using the `yc iam service-account list` command.
   * `ssh-key`: Path to the [public SSH key](../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) file.

{% endlist %}

## Configure Hystax Acura {#setup-hystax-acura}

1. Open the `hystax-acura-vm` VM page in the [management console](https://console.yandex.cloud) and find its public IP address.
1. Enter the `hystax-acura-vm` VM public IP address in your browser. This will open the Hystax Acura initial setup screen.

   {% note info %}

   Booting the Hystax Acura Migration VM for the first time will trigger an installation process which may take over 20 minutes.

   {% endnote %}

1. By default, a Hystax Acura VM has a self-signed certificate.
1. When the setup prompts you to fill out the user profile data, use the values below:
   * **Organization**: Name of your organization.
   * **Admin user login**: Email address for logging in to the admin panel.
   * **Password**: Admin password.
   * **Confirm password**: Re-enter the admin password.
1. Click **Next**.
1. Specify the Yandex Cloud connection settings:
   * **Service account ID**: ID of the service account.
   * **Key ID**: Service account authorized key ID.
   * **Private key**: Service account private key.

     {% note info %}

     If you obtained the ID and private key in a JSON file, e.g., when creating an authorized key via the CLI, remove the line break characters (`\n`) from the ID and the private key.

     {% endnote %}

   * **Default folder ID**: Your folder ID.
   * **Availability zone**: `hystax-acura-vm` VM availability zone.
   * **Hystax Service Subnet**: `hystax-acura-vm` VM subnet ID.
   * **Public IP address of the Hystax Acura control panel**: Public IP address of `hystax-acura-vm` you got in step 1.
   * **Additional parameters**: Do not edit this field.
1. Click **Next**.

Hystax Acura will automatically check whether it can access your cloud. If everything is correct, you will be able to log in to the Hystax control panel with the email address and password you set previously.

## Prepare and install migration agents {#prepare-agent}

You need to install migration agents on the VMs you will be migrating to Yandex Cloud. To download and install the agent, do the following:
1. If you are migrating from VMware ESXi, Microsoft Hyper-V, or any other hypervisor different from KVM, [install virtio drivers](../../compute/operations/image-create/custom-image.md#virtio) on the VM before the migration.
1. In the Hystax Acura control panel, select the **Download agent** tab.
1. Select one of the agent types depending on your OS:
   * VMware
   * Windows
   * Linux

   Click **Next**.
1. Download and install the agent on the VMs you are migrating:

   {% list tabs group=operating_system %}

   - VMware {#vmware}

     1. Select **New VMware vSphere** and fill out these fields:
        * **Platform name**: Name of your platform.
        * **Host IP address**: IP address of the VMware ESXi host where you will deploy the replication agent.
        * **Login**: Your login.
        * **Password**: Your password.

        Click **Next**.
     1. Click **Download agent** and wait for the download to complete.
     1. Unpack the downloaded OVA file to the VMs in your cluster.
     1. Start the VMs with the agent.

   - Windows {#windows}

     1. Click **Next**.
     1. Click **Download agent** and wait for the download to complete.
     1. Unpack the archive and run `hwragent.msi` on the VMs you want to migrate.

   - Linux {#linux}

     1. Select Linux distribution:
        * **CentOS/RHEL (.rpm package)**: CentOS or Red Hat-based.
        * **Debian/Ubuntu (.deb package)**: Ubuntu or Debian.
     1. Select the driver installation method:
        * **Pre-built**: Install a driver binary.
        * **DKMS**: Compile as you install.
     1. Click **Next**.
     1. You will get agent installation commands you can run following the instructions for your distribution and installation method.

   {% endlist %}

The VM will appear in the target group a few minutes after the agent is installed.

## Create VM replicas {#create-replicas}

{% note alert %}

When replication starts, Hystax Acura will create a new Hystax Acura Cloud Agent VM to run operations in your cloud.

{% endnote %}

Start replication:
1. Click the Hystax logo.
1. Under **Machines Groups**, select the virtual machines to replicate.
1. You can specify additional parameters for the `network-ssd` volume in the replication editing menu.
1. Click **Bulk actions** and in the menu that opens, select **Start replication**.

A VM replica will include all original VM data; therefore, replication can take around 40 minutes. You will be able to see the replication status in the **Status** column under **Instance groups**. Wait for the status to change to `Synced` and check whether there are VM replicas in the Compute Cloud list in your folder.

## Create a migration plan {#prepare-migration-plan}

When the VMs you are replicating switch to `Synced`, you can create a migration plan. The migration plan defines the list of VMs to migrate and the order in which they will start in your cloud.
1. Click **Add Migration plan**.
1. Specify the migration plan name: `YC Migration`.
1. Under **Devices & Ranks**, click ![options](../../_assets/options.svg). In the menu that opens, click **Add machine**, select the instance group and then the VM you want to add to the migration plan. Repeat the steps for all VMs you are going to migrate.
1. In the **Subnet ID** and the **CIDR** fields, specify the ID and CIDR of the subnet where the VMs will get connected after migration.
1. Expand the device description and specify the new VM parameters in the **Flavor name** field in this format: `<platform>-<cpu>-<ram>-<core_fraction>`, e.g., `2-8-16-100`.
1. In the **Port ip** field, specify a new IP from the current subnet for the VM.
1. Click **Save**.

## Start migration {#start-migration}

Perform the migration according to the plan:
1. Open the **Migrate** tab.
1. Select the `YC Migration` plan and click **Next**.
1. Specify `CloudSite` in the **Cloud Site Name** field.
1. Make sure all required resources are in the list and click **Run migration**.

The migration process may take about 10 minutes. You can see the status of the VMs being migrated in the **Status** column under **Machines**. Wait for the status to change to `Running`, then make sure all the resources have been transferred and your applications are ready to run. If the migrated infrastructure is working correctly, click **Detach** on the **CloudSite** page and confirm the detach action.

## How to delete the resources you created {#clear-out}

To stop paying for the migration infrastructure:
1. [Delete](../../compute/operations/vm-control/vm-delete.md) `hystax-acura-vm`.
1. [Delete](../../compute/operations/vm-control/vm-delete.md) the secondary `cloud-agent` VMs.
1. [Delete](../../iam/operations/sa/delete.md) the `hystax-acura-account` service account.

If you reserved a public static IP address, [delete it](../../vpc/operations/address-delete.md).