
Migrate Your Virtual Workspace
Notebook

Note
This notebook is in preview and requires your Organization to have access to the Migrate Shared Deployment Feature. Please reach out to us if you'd like to request access.
This notebook should be run on any shared deployment (including on a Free Starter Workspace) in an Organization whose plan allow for the creation of a new dedicated deployment.
To create a Free Starter Workspace navigate to Start using the left nav.
This notebook will show you how to migrate your shared deployment to a new dedicated deployment. All the fields have default values set, but we encourage you to customize them. The required information is:
a new name for your new Workspace in the dedicated deployment
the desired size of your new Workspace in the dedicated deployment (see: https://www.singlestore.com/cloud-pricing/)
a custom name for your new workspace group
the id of the region to create your new workspace group
Warning
During the migration process data written to the shared deployment may not be moved to the new dedicated deployment. The shared deployment will remain available during (and after) the migration process, however any writes to the shared deployment after the migration process begins may not be reflected on the new deployment.
The migration process will copy your data to the new deployment and, by default, move any jobs you had scheduled for your shared deployment to the new deployment. You can elect not to move your scheduled jobs. If you do so, you can manually move them later from the Jobs page.
While your migrated data will also remain available on your shared deployment, if you decided to migrate your Jobs, they are going to be unavailable until the migration process is finished.
Please account for this behavior when migrating.
Choose a Region for the new deployment
Please select the Region you desire your new deployment to be created on from the dropdown after the next cell.
In [1]:
1import requests, os2from ipywidgets import widgets3 4api_url = os.environ['SINGLESTOREDB_MANAGEMENT_BASE_URL']5region_response = requests.get('{}/v2/regions'.format(api_url), headers={'Authorization': 'Bearer {}'.format(connection_password)})6regions = [[f"{r['region']} : {r['provider']} - {r['regionName']}", [r['provider'], r['regionName']]] for r in region_response.json()]7region_dropdown = widgets.Dropdown(8 options = regions,9 value = regions[0][1],10 description = 'Region:',11 disabled = False,12)13 14display(region_dropdown)
Choose a Name for the new workspace group
Please insert the name for your new Workspace Group in text box after the next cell.
In [2]:
1from ipywidgets import widgets2 3workspace_group_name_text_box = widgets.Text(4 value='MigrationGroup',5 placeholder='Insert a name',6 description='Name:'7)8 9display(workspace_group_name_text_box)
Choose a Name for the new workspace
Please insert the name for your new Workspace in text box after the next cell.
In [3]:
1from ipywidgets import widgets2 3workspace_name_text_box = widgets.Text(4 value='migrated-workspace',5 placeholder='Insert a name',6 description='Name:'7)8 9display(workspace_name_text_box)
Choose the size for the new workspace
Please insert the size for your new Workspace in text box after the next cell. If you are unsure which size to choose, you can check them here.
In [4]:
1from ipywidgets import widgets2 3size_text_box = widgets.Text(4 value='S-00',5 placeholder='Insert a size',6 description='Size:',7 layout={'width': 'max-content'}8)9 10display(size_text_box)
Warning
After runnig the next cell, data written to the shared deployment may not be moved to the new Workspace.
If you do not wish to move your scheduled jobs, you should set "migrateScheduledJobs" to false on the request body below.
Begin the migration process
Runing the next cell will start the migration process
In [5]:
1import requests, os2from ipywidgets import widgets3 4workspace_id = os.environ['SINGLESTOREDB_VIRTUAL_WORKSPACE']5api_url = os.environ['SINGLESTOREDB_MANAGEMENT_BASE_URL']6 7migrate_response = requests.post('{}/v1/sharedtier/virtualWorkspaces/{}/migrate'.format(api_url, workspace_id), headers={'Authorization': 'Bearer {}'.format(connection_password)}, json={8 "migrateScheduledJobs": True,9 "destinationWorkspace": {10 "name": workspace_name_text_box.value,11 "provider": region_dropdown.value[0],12 "regionName": region_dropdown.value[1],13 "size": size_text_box.value,14 "workspaceGroupName": workspace_group_name_text_box.value15 }16})17 18if migrate_response.status_code == 200:19 display(widgets.HTML(f"<div class='alert alert-block alert-success'><b class='fa fa-solid fa-check-circle'></b><div><p><b>Migration Started</b></p><p>See next cell for progress</p></div></div>"))20else:21 display(widgets.HTML(f"<div class='alert alert-block alert-danger'><b class='fa fa-solid fa-exclamation-triangle'></b><div><p><b>Failed to Start Migration</b></p><p>{migrate_response.status_code} - {migrate_response.text}</p></div></div>"))
Check the progress of the migration
Running the next cell will give you progress on the migration
In [6]:
1import requests, os, time2from ipywidgets import widgets3 4workspace_id = os.environ['SINGLESTOREDB_VIRTUAL_WORKSPACE']5organization_id = os.environ['SINGLESTOREDB_ORGANIZATION']6api_url = os.environ['SINGLESTOREDB_MANAGEMENT_BASE_URL']7 8status_response = requests.get('{}/v1/sharedtier/virtualWorkspaces/{}/migrations'.format(api_url, workspace_id), headers={'Authorization': 'Bearer {}'.format(connection_password)})9 10if status_response.json()[0]["migrationStatus"] == "SUCCEEDED":11 display(widgets.HTML('<div class="alert alert-block alert-success"><b class="fa fa-solid fa-check-circle"></b><div><p><b>Success</b></p><p>The migration has completed succesfully! you can now visit your new workpace in the deployments page. If you wish to do so, you can now terminate your shared deployment from the deployments page.</p></div></div>'))12 13else:14 display(widgets.HTML('<div class="alert alert-block alert-info"><b class="fa fa-solid fa-info-circle"></b><div><p><b>In Progress</b></p><p>your Shared Deployment is being migrated.</p></div></div>'))15 16 while status_response.json()[0]["migrationStatus"] not in ["SUCCEEDED", "FAILED"]:17 time.sleep(30)18 status_response = requests.get('{}/v1/sharedtier/virtualWorkspaces/{}/migrations'.format(api_url, workspace_id), headers={'Authorization': 'Bearer {}'.format(connection_password)})19 20 21 if status_response.json()[0]["migrationStatus"] == "SUCCEEDED":22 display(widgets.HTML('<div class="alert alert-block alert-success"><b class="fa fa-solid fa-check-circle"></b><div><p><b>Success</b></p><p>The migration has completed succesfully! you can now visit your new workpace in the deployments page. If you wish to do so, you can now terminate your shared deployment from the deployments page.</p></div></div>'))23 else:24 display(widgets.HTML("<div class='alert alert-block alert-danger'><b class='fa fa-solid fa-exclamation-triangle'></b><div><p><b>Failed to Complete Migrate</b></p><p>The migration process failed, please contact support</p></div></div>"))

Details
About this Template
Learn how to migrate Your VirtualWorkspace to a full-fledged Workspace in a dedicated Workspace Group.
This Notebook can be run in Standard and Enterprise deployments.
Tags
License
This Notebook has been released under the Apache 2.0 open source license.
See Notebook in action
Launch this notebook in SingleStore and start executing queries instantly.