CLI Tutorial: Environment Migration

CLI Tutorial: Environment Migration

Sometimes, it is necessary to shift your application to a different environment that offers improved conditions or is in a better location. Alternatively, you may need to replicate your environment across various hardware setups to enhance availability. To do this remotely, you must run a specific migration command line method using your terminal. Let’s delve into this further.

1. First off, you’ll need to grab the list of regions offered on the platform. To do this, use the “getregions” command, but make sure to apply the right search filter. By doing this, the output will be reduced and it will be easier to understand.


~/jelastic/environment/control/getregions | sed -rne '/(uniqueName|isEnabled|displayName)/{/Name/,/isEnabled/p}'

Linked regions to account

On your dashboard, you’ll find a list of environmental regions linked to your account, each marked as ‘isEnabled’ (meaning it’s active). They’re identified by their display names and unique identifiers. Remember, the crucial detail here is the unique identifier.

Note: The top-tier list provides an overview of general information regarding data centers. However, the specific parameters for each region, which you’ll need for additional tasks, are displayed in a lower tier (these lines are indented to the right).

To clarify further, the distinct ‘uniqueName‘ values are highlighted within the image provided.

2. Before initiating the operation, it’s wise to assess whether migration is feasible. Utilize the CheckMigrationPossibility CLI method tailored for this purpose.


~/jelastic/environment/control/checkmigrationpossibility --envName {env_name} --hardwareNodeGroup {region_id}

Here are the details you need:

  • {env_name}: This is the name of the environment you want to move.
  • {region_id}: This is a special code that identifies the specific region where you want to relocate your environment, as determined in the previous step.

Check migration possibility

3. You’ve got everything you need to start moving things over:


~/jelastic/environment/control/migrate --envName {env_name} --hardwareNodeGroup {region_id} --isOnline {true/false}

The only thing that’s different now is the addition of the “isOnline” parameter. You can choose to set it as either “true” or “false” to decide whether you want to use the live migration mode or the offline one.

Option for migration mode

Before long (though the timing could shift depending on your setup), the process will wrap up, and your application will smoothly transition to its new location.

Save $100 in the next
5:00 minutes?

Register Here