{"id":4359,"date":"2019-10-28T16:16:34","date_gmt":"2019-10-28T19:16:34","guid":{"rendered":"https:\/\/www.dbarj.com.br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/"},"modified":"2019-10-28T17:04:09","modified_gmt":"2019-10-28T20:04:09","slug":"automating-clone-of-oci-compute-instance-across-regions","status":"publish","type":"post","link":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/","title":{"rendered":"Automating clone of OCI compute instances across regions"},"content":{"rendered":"<p>Oracle is constantly releasing new regions around the globe for the Oracle Cloud Infrastructure, and geolocation is something very important for companies specially to achieve low latencies and high throughput.<\/p>\n<p><span style=\"color: #000000;\"><strong>After those regions are out, I&#8217;ve been asked for some customers to move their existing computes from one region to another. After doing the same steps for about 3 times, I decided to automate it in a script and share with the community =]<\/strong><\/span><\/p>\n<p>The script is public available at my github oci-scripts page: <a href=\"https:\/\/github.com\/dbarj\/oci-scripts\/blob\/master\/oci_compute_clone_xregion.sh\">oci_compute_clone_xregion.sh<\/a><\/p>\n<h3>Before we start<\/h3>\n<p>So, when thinking about moving something from one region to another, usually there are 2 very important things to consider:<\/p>\n<p><strong>1. Migrate it consistently <\/strong>among all attached volumes (and boot-volume).<\/p>\n<p>Reason item 1 is important is because if you copy the boot-volumes and volumes on different point-of-times, you will probably end-up in an inconsistent state of your server. Imagine, ie, an Oracle Database where the datafiles and logfiles are spread over multiple volumes.<\/p>\n<p><strong>2. Do it fully online<\/strong>, without stopping the original compute (specially when cloning for dev provisioning).<\/p>\n<p>And item 2 is to ensure we won&#8217;t impact the original environment while performing the cloning operation. This script can also be used to provision dev environments without stopping prod. If you intend to move\u00a0 a production application from one region to another, in this case you may need to STOP de source so nothing gets written after the cloning operation starts.<\/p>\n<h3>How does it work?<\/h3>\n<p>The <strong>oci_compute_clone_xregion.sh<\/strong> is a 100% public bash shell script tool that will execute several steps.<\/p>\n<p>The script was written after I had to perform the same set of instructions manually a lot of times. It is not complex. It works by getting all the current information of machine in JSON, including the attached disks, attached vnics, etc. Then it will take the compute backup, move it to the other region and create a clone machine using the same properties.<\/p>\n<p>I&#8217;ve end up with the following steps<\/p>\n<p><strong><span style=\"color: #0000ff;\">1 &#8211; Create Volume Group with source instance Boot-Volume and Volumes.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">2 &#8211; Backup Volume Group.<br \/>\n<span style=\"color: #000000;\">\u00a0 \u21b3 Will\u00a0 create a volume group with all your compute instance attached volumes and take a backup of it, to ensure they will all be in the same point of time.<br \/>\n<\/span><\/span><\/strong><strong><span style=\"color: #0000ff;\">3 &#8211; Remove Volume Group.<br \/>\n<\/span><\/strong><span style=\"color: #000000;\"><strong>\u21b3 Now we don&#8217;t need the volume group created on step 1 anymore. We can remove it (note the backup of item 2 will be kept).<\/strong><\/span><br \/>\n<strong><span style=\"color: #0000ff;\">4 &#8211; Create a New Boot-Volume from the Backup.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">5 &#8211; Create a Temporary cloned Compute Instance from the Boot Volume.<br \/>\n<\/span><\/strong><span style=\"color: #000000;\"><b>\u21b3 We can&#8217;t transfer boot-volumes across regions, only compute images. However, to create an image of a compute, the instance is stopped. To avoid stopping our source compute (which may be in use for production), we create a temporary compute from the original boot-volume backup (item 2) just to create an image of it without affecting the source.<\/b><\/span><br \/>\n<strong><span style=\"color: #0000ff;\">6 &#8211; Stop the Temporary cloned Compute Instance.<\/span><\/strong><br \/>\n<span style=\"color: #0000ff;\"><span style=\"color: #0000ff;\"><b>7 &#8211; Create an Image from it.<\/b><\/span><br \/>\n<span style=\"color: #000000;\"><b>\u21b3 Now we take the image of the temporary cloned compute to transfer across the regions.<\/b><\/span><br \/>\n<\/span><strong><span style=\"color: #0000ff;\">8 &#8211; Remove the Temporary cloned Compute Instance and Boot-Volume.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 We don&#8217;t need it anymore.<\/b><\/span><\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">9 &#8211; Move the image from source to target.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 Now we need to move the image to the target region. This image will be used to generate the final cloned compute.<\/b><\/span><\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">10 &#8211; Remove Image on source region.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">11- Create a Compute Instance from Image on target region.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 The new compute is now created on the target region.<\/b><\/span><\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">12 &#8211; Remove Image on target region.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">13 &#8211; Move Volumes Backups from Source Region to Target Region.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 Now it&#8217;s time to move the volumes backups created on step 2. The target instance must have the same attached volumes as the source.<\/b><\/span><\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">14 &#8211; Remove Volumes Backups in Source Region.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 We can remove the backups created on step 2 as we already have everything we need on the target region.<\/b><\/span><\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">15 &#8211; Create Volumes from backups in Target Region.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">16 &#8211; Remove Volumes Backups in Target Region.<\/span><\/strong><br \/>\n<strong><span style=\"color: #0000ff;\">17 &#8211; Attach Volumes in target.<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 We create volumes from the backups, remove the backups and then attach the new volumes to the new instance, so we have it just like the original.<\/b><\/span><br \/>\n<\/span><\/strong><strong><span style=\"color: #0000ff;\">18 &#8211; Run iscsiadm commands on target (if Linux).<br \/>\n<span style=\"color: #000000;\"><b>\u21b3 Finally, the iscsiadm commands are created and printed out on the screen to map all the new volumes.<\/b><\/span><br \/>\n<\/span><\/strong><\/p>\n<p><strong>Note that the steps 13-18 will be skipped if the source instance has no attached volumes.<\/strong><\/p>\n<h3>Script Usage:<\/h3>\n<p>Script latest version can be downloaded from github at: <a href=\"https:\/\/github.com\/dbarj\/oci-scripts\/blob\/master\/oci_compute_clone_xregion.sh\">https:\/\/github.com\/dbarj\/oci-scripts\/blob\/master\/oci_compute_clone_xregion.sh<\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">$ oci_compute_clone_xregion.sh -h\r\nUsage: oci_compute_clone_xregion.sh -i &lt;value&gt; [-n &lt;value&gt;] [-p &lt;value&gt;] [-s &lt;value&gt;] [-a &lt;value&gt;] [-t &lt;value&gt;] [-r &lt;value&gt;] [-b &lt;value&gt;] [-c &lt;value&gt;] [-q] [-x]\r\n\r\nOnly \"-i\" is mandatory. All other parameters if omitted will be asked during execution.\r\n\r\n-i  : Source Compute Instance Name or OCID\r\n-n  : Target Compute Instance Name\r\n-p  : Target Compute Shape\r\n-s  : Target Subnet ID\r\n-a  : Target IP Address\r\n-t  : Target Region\r\n-r  : Source Region\r\n-b  : Object Storage Bucket Name\r\n-c  : Clone Subnet ID\r\n-h  : Show this output.\r\n-q  : Quiet mode. Will suppress the spool of executed OCI-CLI commands.\r\n-x  : Will try to run step 22 automatically on new target. Default is off. Note you need a password-less SSH connection to the target with opc.<\/pre>\n<p>Basically the only mandatory parameter is the source Compute Instance display name or OCID, specified with <strong>[-i]<\/strong>. All the others will be interactively asked if not specified.<\/p>\n<p>Some details:<\/p>\n<p>[-b] = To move a compute image across regions, it must be stored on a local Object Storage. I recommend to use a Standard Private OS for this.<\/p>\n<p>[-c] = As mentioned before, to create the source compute image without affecting the availability on source, a local temporary replica is created. This parameter specifies where the local replica is gonna be placed. For some specific scenarios, you may want to keep it in a isolated compartment\/vpn\/subnet.<\/p>\n<p>[-q] = During each step you can see the currently being executed oci-cli command. Use this option to suppress it.<\/p>\n<p>[-x] = Check &#8220;Execution Example&#8221; step 22 for more details.<\/p>\n<p>Note that before running anything, the script does multiple validations to ensure the given values are valid.<\/p>\n<h3>Pre-requisites<\/h3>\n<p>The <strong>oci_compute_clone_xregion.sh<\/strong>\u00a0depends that you have a\u00a0<strong>bash shell<\/strong>,<strong> jq and oci_image_clone_xregion.sh<\/strong>.<\/p>\n<h4>Bash Shell<\/h4>\n<p>Bash is the GNU Project&#8217;s shell. It\u2019s available on most UNIX operating systems, like Linux and Mac.<\/p>\n<h4>JQ<\/h4>\n<p>JQ stands for\u00a0<strong>Json Query<\/strong>, it\u2019s a parser that is required to generate and process JSON files generated by cURL. It\u2019s available at\u00a0<a href=\"https:\/\/github.com\/stedolan\/jq\/releases\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/stedolan\/jq\/releases<\/a><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[user@localhost ~]$ cd ~\/bin\r\n[user@localhost ~]$ wget -O jq https:\/\/github.com\/stedolan\/jq\/releases\/download\/jq-1.5\/jq-linux64\r\n100%[===========================================&gt;] 2.89M 862KB\/s in 3.8s\r\n2018-09-17 18:55:00 (776 KB\/s) - \u2018jq\u2019 saved [3027945\/3027945]\r\n[user@localhost ~]$ chmod +x jq\r\n[user@localhost ~]$ export PATH=$PATH:`pwd`\r\n[user@localhost ~]$ which jq\r\n\/Users\/myuser\/bin\/jq<\/pre>\n<p>Some linux distributions also provides JQ straight from the yum repository.<\/p>\n<h4><strong>oci_image_clone_xregion.sh<\/strong><\/h4>\n<p>The <a href=\"https:\/\/github.com\/dbarj\/oci-scripts\/blob\/master\/oci_image_clone_xregion.sh\">oci_image_clone_xregion.sh <\/a>is another script in my github repo that will handle the <span style=\"color: #0000ff;\"><strong>step 9<\/strong><\/span> of the flow. The script must simply be placed in the same directory.<\/p>\n<h3>Execution Example:<\/h3>\n<p><em>Note: OCID values were masked for security.<\/em><\/p>\n<p>Calling the script. Note I&#8217;ve passed all parameters, however only the [-i] is mandatory.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">$ oci_compute_clone_xregion.sh \\\r\n-i ocid1.instance.oc1.iad.sss \\\r\n-n OCSPNPRDORADB01 \\\r\n-p VM.Standard2.8 \\\r\n-s ocid1.subnet.oc1.sa-saopaulo-1.ccc \\\r\n-a 172.16.X.X \\\r\n-r us-ashburn-1 \\\r\n-t sa-saopaulo-1 \\\r\n-b REGION_MIGRATION\r\nChecking Compute Name and OCID.\r\nCompute Name: OCASNPRDORADB01\r\nCompute OCID: ocid1.instance.oc1.iad.sss\r\nGetting OCI Compute information..\r\nThe Source machine will be temporarily cloned within the same region, so an image can be created without stopping it.\r\nOptions:\r\n- YES\r\n- NO\r\nCreate temporary Clone Compute machine in same subnet as the source [YES]:<\/pre>\n<p>This question was made because I haven&#8217;t passed the [-c] parameter, specifying where I want to create the temporary cloned instance. If you answer <strong>YES<\/strong>, it will be created at the same subnet as the source. If you answer <strong>NO<\/strong>, you will be asked for the compartment, vcn and subnet names.<\/p>\n<p>Before the script get started, it will print once again all the overall steps.<\/p>\n<pre class=\"wrap:true lang:sh decode:true\">Starting execution.\r\nSteps:\r\n01 - Create Volume Group with instance Boot-Volume and Volumes.\r\n02 - Backup Volume Group.\r\n03 - Remove Volume Group.\r\n04 - Create a New Boot-Volume from the Backup.\r\n05 - Create a Temporary cloned Compute Instance from the Boot Volume.\r\n06 - Stop the Temporary cloned Compute Instance.\r\n07 - Create an Image from it.\r\n08 - Remove the Temporary cloned Compute Instance and Boot-Volume.\r\n09-13 - Move the image from source to target (oci_image_clone_xregion.sh).\r\n14 - Remove Image on source region.\r\n15 - Create a Compute Instance from Image on target region.\r\n16 - Remove Image on target region.\r\n17 - Move Volumes Backups from Source Region to Target Region.\r\n18 - Remove Volumes Backups in Source Region.\r\n19 - Create Volumes from backups in Target Region.\r\n20 - Remove Volumes Backups in Target Region.\r\n21 - Attach Volumes in target.\r\n22 - Run iscsiadm commands on target (if Linux).<\/pre>\n<p>During the execution, you will be able to see each <strong>oci-cli<\/strong> command executed by the steps of the shell.<\/p>\n<p><strong><span style=\"color: #008000;\">Executing Step 1<\/span><\/strong><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv volume-group create --compartment-id ocid1.compartment.oc1..fff --availability-domain XkLK:US-ASHBURN-AD-1 --display-name OCASNPRDORADB01_VG --max-wait-seconds 3600 --wait-for-state AVAILABLE --source-details '{\"type\":\"volumeIds\",\"volumeIds\": [\"ocid1.bootvolume.oc1.iad.mmm\",\"ocid1.volume.oc1.iad.ppp\"]}'\r\nAction completed. Waiting until the resource has entered state: ('AVAILABLE',)\r\n+ v_orig_VGJson='{\r\n  \"data\": {\r\n    \"availability-domain\": \"XkLK:US-ASHBURN-AD-1\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_VG\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.volumegroup.oc1.iad.kkk\",\r\n    \"is-hydrated\": null,\r\n    \"lifecycle-state\": \"AVAILABLE\",\r\n    \"size-in-gbs\": 410,\r\n    \"size-in-mbs\": 419840,\r\n    \"source-details\": {\r\n      \"type\": \"volumeIds\",\r\n      \"volume-ids\": [\r\n        \"ocid1.bootvolume.oc1.iad.mmm\",\r\n        \"ocid1.volume.oc1.iad.ppp\"\r\n      ]\r\n    },\r\n    \"time-created\": \"2019-10-27T20:30:37.909000+00:00\",\r\n    \"volume-ids\": [\r\n      \"ocid1.bootvolume.oc1.iad.mmm\",\r\n      \"ocid1.volume.oc1.iad.ppp\"\r\n    ]\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><strong><span style=\"color: #008000;\">Executing Step 2<\/span><\/strong><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv volume-group-backup create --compartment-id ocid1.compartment.oc1..fff --volume-group-id ocid1.volumegroup.oc1.iad.kkk --display-name OCASNPRDORADB01_VG_BKP --type INCREMENTAL --wait-for-state AVAILABLE --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('AVAILABLE',)\r\n+ v_orig_VGBackupJson='{\r\n  \"data\": {\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_VG_BKP\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.volumegroupbackup.oc1.iad.jjj\",\r\n    \"lifecycle-state\": \"AVAILABLE\",\r\n    \"size-in-gbs\": 410,\r\n    \"size-in-mbs\": 419840,\r\n    \"time-created\": \"2019-10-27T20:30:57.562000+00:00\",\r\n    \"time-request-received\": \"2019-10-27T20:30:41.218000+00:00\",\r\n    \"type\": \"INCREMENTAL\",\r\n    \"unique-size-in-gbs\": 145,\r\n    \"unique-size-in-mbs\": 147762,\r\n    \"volume-backup-ids\": [\r\n      \"ocid1.bootvolumebackup.oc1.iad.qqq\",\r\n      \"ocid1.volumebackup.oc1.iad.nnn\"\r\n    ],\r\n    \"volume-group-id\": \"ocid1.volumegroup.oc1.iad.kkk\"\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 3<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv volume-group delete --volume-group-id ocid1.volumegroup.oc1.iad.kkk --force --wait-for-state TERMINATED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('TERMINATED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 4<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv boot-volume create --boot-volume-backup-id ocid1.bootvolumebackup.oc1.iad.qqq --display-name OCASNPRDORADB01_CLONE_BV --availability-domain XkLK:US-ASHBURN-AD-1 --wait-for-state AVAILABLE --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('AVAILABLE',)\r\n+ v_clone_BVJson='{\r\n  \"data\": {\r\n    \"availability-domain\": \"XkLK:US-ASHBURN-AD-1\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_CLONE_BV\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.bootvolume.oc1.iad.ooo\",\r\n    \"image-id\": \"ocid1.image.oc1.iad.aaa\",\r\n    \"is-hydrated\": false,\r\n    \"kms-key-id\": null,\r\n    \"lifecycle-state\": \"AVAILABLE\",\r\n    \"size-in-gbs\": 100,\r\n    \"size-in-mbs\": 102400,\r\n    \"source-details\": {\r\n      \"id\": \"ocid1.bootvolumebackup.oc1.iad.qqq\",\r\n      \"type\": \"bootVolumeBackup\"\r\n    },\r\n    \"system-tags\": {},\r\n    \"time-created\": \"2019-10-27T20:33:22.981000+00:00\",\r\n    \"volume-group-id\": null\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 5<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute instance launch --compartment-id ocid1.compartment.oc1..fff --availability-domain XkLK:US-ASHBURN-AD-1 --shape VM.Standard2.1 --wait-for-state RUNNING --max-wait-seconds 3600 --display-name OCASNPRDORADB01_CLONE_INST --source-boot-volume-id ocid1.bootvolume.oc1.iad.ooo --subnet-id ocid1.subnet.oc1.iad.ddd --assign-public-ip false\r\nAction completed. Waiting until the resource has entered state: ('RUNNING',)\r\n+ v_clone_instJson='{\r\n  \"data\": {\r\n    \"agent-config\": {\r\n      \"is-monitoring-disabled\": false\r\n    },\r\n    \"availability-domain\": \"XkLK:US-ASHBURN-AD-1\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"dedicated-vm-host-id\": null,\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_CLONE_INST\",\r\n    \"extended-metadata\": {},\r\n    \"fault-domain\": \"FAULT-DOMAIN-1\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.instance.oc1.iad.ttt\",\r\n    \"image-id\": \"ocid1.image.oc1.iad.aaa\",\r\n    \"ipxe-script\": null,\r\n    \"launch-mode\": \"NATIVE\",\r\n    \"launch-options\": {\r\n      \"boot-volume-type\": \"PARAVIRTUALIZED\",\r\n      \"firmware\": \"UEFI_64\",\r\n      \"is-consistent-volume-naming-enabled\": true,\r\n      \"is-pv-encryption-in-transit-enabled\": true,\r\n      \"network-type\": \"PARAVIRTUALIZED\",\r\n      \"remote-data-volume-type\": \"PARAVIRTUALIZED\"\r\n    },\r\n    \"lifecycle-state\": \"RUNNING\",\r\n    \"metadata\": {},\r\n    \"region\": \"iad\",\r\n    \"shape\": \"VM.Standard2.1\",\r\n    \"source-details\": {\r\n      \"boot-volume-id\": \"ocid1.bootvolume.oc1.iad.ooo\",\r\n      \"source-type\": \"bootVolume\"\r\n    },\r\n    \"system-tags\": {},\r\n    \"time-created\": \"2019-10-27T20:33:41.886000+00:00\",\r\n    \"time-maintenance-reboot-due\": null\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 6<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute instance action --instance-id ocid1.instance.oc1.iad.ttt --action STOP --wait-for-state STOPPED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('STOPPED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 7<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute image create --compartment-id ocid1.compartment.oc1..fff --display-name OCASNPRDORADB01_IMAGE --instance-id ocid1.instance.oc1.iad.ttt --wait-for-state AVAILABLE --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('AVAILABLE',)\r\n+ v_clone_imageJson='{\r\n  \"data\": {\r\n    \"agent-features\": null,\r\n    \"base-image-id\": \"ocid1.image.oc1.iad.aaa\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"create-image-allowed\": true,\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_IMAGE\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.image.oc1.iad.eee\",\r\n    \"launch-mode\": \"NATIVE\",\r\n    \"launch-options\": {\r\n      \"boot-volume-type\": \"PARAVIRTUALIZED\",\r\n      \"firmware\": \"UEFI_64\",\r\n      \"is-consistent-volume-naming-enabled\": true,\r\n      \"is-pv-encryption-in-transit-enabled\": true,\r\n      \"network-type\": \"PARAVIRTUALIZED\",\r\n      \"remote-data-volume-type\": \"PARAVIRTUALIZED\"\r\n    },\r\n    \"lifecycle-state\": \"AVAILABLE\",\r\n    \"operating-system\": \"Oracle Linux\",\r\n    \"operating-system-version\": \"6.10\",\r\n    \"size-in-mbs\": 102400,\r\n    \"time-created\": \"2019-10-27T20:34:57.238000+00:00\"\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 8<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute instance terminate --instance-id ocid1.instance.oc1.iad.ttt --preserve-boot-volume false --force --wait-for-state TERMINATED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('TERMINATED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p>The steps 9-14 are executed by <strong>oci_image_clone_xregion.sh. <\/strong>Before the sub-script get started, it will print all the overall steps.<\/p>\n<pre class=\"wrap:true lang:sh decode:true\">Steps:\r\n09 - Export the Image.\r\n10 - Create Pre-Auth URL.\r\n11 - Import the Image in target region.\r\n12 - Remove exported Image object.\r\n13 - Remove Pre-Auth URL.<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 9<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute image export to-object --image-id ocid1.image.oc1.iad.eee --namespace mytenancy --bucket-name REGION_MIGRATION --name OCASNPRDORADB01_IMAGE_IMAGE_EXPORT\r\n+ v_jsonImageExport='{\r\n  \"data\": {\r\n    \"agent-features\": null,\r\n    \"base-image-id\": \"ocid1.image.oc1.iad.aaa\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"create-image-allowed\": true,\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_IMAGE\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.image.oc1.iad.eee\",\r\n    \"launch-mode\": \"NATIVE\",\r\n    \"launch-options\": {\r\n      \"boot-volume-type\": \"PARAVIRTUALIZED\",\r\n      \"firmware\": \"UEFI_64\",\r\n      \"is-consistent-volume-naming-enabled\": true,\r\n      \"is-pv-encryption-in-transit-enabled\": true,\r\n      \"network-type\": \"PARAVIRTUALIZED\",\r\n      \"remote-data-volume-type\": \"PARAVIRTUALIZED\"\r\n    },\r\n    \"lifecycle-state\": \"EXPORTING\",\r\n    \"operating-system\": \"Oracle Linux\",\r\n    \"operating-system-version\": \"6.10\",\r\n    \"size-in-mbs\": 102400,\r\n    \"time-created\": \"2019-10-27T20:34:57.238000+00:00\"\r\n  },\r\n  \"etag\": \"xxx\",\r\n  \"opc-work-request-id\": \"ocid1.coreservicesworkrequest.oc1.iad.lll\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.\r\nImage status is EXPORTING. Please wait.<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 10<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 os preauth-request create --namespace mytenancy --bucket-name REGION_MIGRATION --object-name OCASNPRDORADB01_IMAGE_IMAGE_EXPORT --name OCASNPRDORADB01_IMAGE_PREAUTH --access-type ObjectRead --time-expires 2019-10-29\r\n+ v_jsonPreAuthReq='{\r\n  \"data\": {\r\n    \"access-type\": \"ObjectRead\",\r\n    \"access-uri\": \"\/p\/xxx\/n\/mytenancy\/b\/REGION_MIGRATION\/o\/OCASNPRDORADB01_IMAGE_IMAGE_EXPORT\",\r\n    \"id\": \"xxx=:OCASNPRDORADB01_IMAGE_IMAGE_EXPORT\",\r\n    \"name\": \"OCASNPRDORADB01_IMAGE_PREAUTH\",\r\n    \"object-name\": \"OCASNPRDORADB01_IMAGE_IMAGE_EXPORT\",\r\n    \"time-created\": \"2019-10-27T21:07:24.884000+00:00\",\r\n    \"time-expires\": \"2019-10-29T00:00:00+00:00\"\r\n  }\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 11<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 compute image import from-object-uri --compartment-id ocid1.compartment.oc1..fff --display-name OCASNPRDORADB01_IMAGE --launch-mode NATIVE --source-image-type QCOW2 --uri https:\/\/objectstorage.us-ashburn-1.oraclecloud.com\/p\/xxx\/n\/mytenancy\/b\/REGION_MIGRATION\/o\/OCASNPRDORADB01_IMAGE_IMAGE_EXPORT --freeform-tags '{\"Source_OCID\":\"ocid1.image.oc1.iad.eee\"}'\r\n+ v_jsonImageImport='{\r\n  \"data\": {\r\n    \"agent-features\": null,\r\n    \"base-image-id\": null,\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"create-image-allowed\": true,\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_IMAGE\",\r\n    \"freeform-tags\": {\r\n      \"Source_OCID\": \"ocid1.image.oc1.iad.eee\"\r\n    },\r\n    \"id\": \"ocid1.image.oc1.sa-saopaulo-1.bbb\",\r\n    \"launch-mode\": \"NATIVE\",\r\n    \"launch-options\": {\r\n      \"boot-volume-type\": \"ISCSI\",\r\n      \"firmware\": \"UEFI_64\",\r\n      \"is-consistent-volume-naming-enabled\": false,\r\n      \"is-pv-encryption-in-transit-enabled\": false,\r\n      \"network-type\": \"VFIO\",\r\n      \"remote-data-volume-type\": \"PARAVIRTUALIZED\"\r\n    },\r\n    \"lifecycle-state\": \"IMPORTING\",\r\n    \"operating-system\": \"Custom\",\r\n    \"operating-system-version\": \"Custom\",\r\n    \"size-in-mbs\": null,\r\n    \"time-created\": \"2019-10-27T21:07:26.656000+00:00\"\r\n  },\r\n  \"etag\": \"xxx\",\r\n  \"opc-work-request-id\": \"ocid1.coreservicesworkrequest.oc1.sa-saopaulo-1.ggg\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.\r\nImage status is IMPORTING. Please wait.<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 12<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 os object delete --namespace mytenancy --bucket-name REGION_MIGRATION --object-name OCASNPRDORADB01_IMAGE_IMAGE_EXPORT --force\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 13<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 os preauth-request delete --namespace mytenancy --bucket-name REGION_MIGRATION --par-id xxx=:OCASNPRDORADB01_IMAGE_IMAGE_EXPORT --force\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\n++ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 compute image list --compartment-id ocid1.compartment.oc1..fff\r\n++ jq -rc '.data[] | select (.\"freeform-tags\".\"Source_OCID\"==\"ocid1.image.oc1.iad.eee\")'\r\n+ v_target_imageJson='{\"agent-features\":null,\"base-image-id\":null,\"compartment-id\":\"ocid1.compartment.oc1..fff\",\"create-image-allowed\":true,\"defined-tags\":{},\"display-name\":\"OCASNPRDORADB01_IMAGE\",\"freeform-tags\":{\"Source_OCID\":\"ocid1.image.oc1.iad.eee\"},\"id\":\"ocid1.image.oc1.sa-saopaulo-1.bbb\",\"launch-mode\":\"NATIVE\",\"launch-options\":{\"boot-volume-type\":\"PARAVIRTUALIZED\",\"firmware\":\"UEFI_64\",\"is-consistent-volume-naming-enabled\":true,\"is-pv-encryption-in-transit-enabled\":true,\"network-type\":\"PARAVIRTUALIZED\",\"remote-data-volume-type\":\"PARAVIRTUALIZED\"},\"lifecycle-state\":\"AVAILABLE\",\"operating-system\":\"Custom\",\"operating-system-version\":\"Custom\",\"size-in-mbs\":102400,\"time-created\":\"2019-10-27T21:07:26.656000+00:00\"}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 14<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 compute image delete --image-id ocid1.image.oc1.iad.eee --force --wait-for-state DELETED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('DELETED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 15<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 compute instance launch --skip-source-dest-check true --assign-public-ip false --metadata '{\"ssh_authorized_keys\":\"ssh-rsa xxx\"}' --fault-domain FAULT-DOMAIN-2 --is-pv-encryption-in-transit-enabled true --launch-options '{\"bootVolumeType\": \"PARAVIRTUALIZED\",\"firmware\": \"UEFI_64\",\"isConsistentVolumeNamingEnabled\": \"true\",\"networkType\": \"VFIO\",\"remoteDataVolumeType\": \"PARAVIRTUALIZED\"}' --availability-domain XkLK:SA-SAOPAULO-1-AD-1 --shape VM.Standard2.8 --wait-for-state RUNNING --max-wait-seconds 3600 --display-name OCSPNPRDORADB01 --image-id ocid1.image.oc1.sa-saopaulo-1.bbb --subnet-id ocid1.subnet.oc1.sa-saopaulo-1.ccc --private-ip 172.16.X.X --compartment-id ocid1.compartment.oc1..fff\r\nAction completed. Waiting until the resource has entered state: ('RUNNING',)\r\n+ v_target_instJson='{\r\n  \"data\": {\r\n    \"agent-config\": {\r\n      \"is-monitoring-disabled\": false\r\n    },\r\n    \"availability-domain\": \"XkLK:SA-SAOPAULO-1-AD-1\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"dedicated-vm-host-id\": null,\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCSPNPRDORADB01\",\r\n    \"extended-metadata\": {},\r\n    \"fault-domain\": \"FAULT-DOMAIN-2\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.instance.oc1.sa-saopaulo-1.rrr\",\r\n    \"image-id\": \"ocid1.image.oc1.sa-saopaulo-1.bbb\",\r\n    \"ipxe-script\": null,\r\n    \"launch-mode\": \"NATIVE\",\r\n    \"launch-options\": {\r\n      \"boot-volume-type\": \"PARAVIRTUALIZED\",\r\n      \"firmware\": \"UEFI_64\",\r\n      \"is-consistent-volume-naming-enabled\": true,\r\n      \"is-pv-encryption-in-transit-enabled\": true,\r\n      \"network-type\": \"VFIO\",\r\n      \"remote-data-volume-type\": \"PARAVIRTUALIZED\"\r\n    },\r\n    \"lifecycle-state\": \"RUNNING\",\r\n    \"metadata\": {\r\n      \"ssh_authorized_keys\": \"ssh-rsa xxx\"\r\n    },\r\n    \"region\": \"sa-saopaulo-1\",\r\n    \"shape\": \"VM.Standard2.8\",\r\n    \"source-details\": {\r\n      \"boot-volume-size-in-gbs\": null,\r\n      \"image-id\": \"ocid1.image.oc1.sa-saopaulo-1.bbb\",\r\n      \"kms-key-id\": null,\r\n      \"source-type\": \"image\"\r\n    },\r\n    \"system-tags\": {},\r\n    \"time-created\": \"2019-10-27T21:43:59.348000+00:00\",\r\n    \"time-maintenance-reboot-due\": null\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 16<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 compute image delete --image-id ocid1.image.oc1.sa-saopaulo-1.bbb --force --wait-for-state DELETED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('DELETED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 17<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">There are backups with status CREATING in target. Please wait.\r\n++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv backup copy --volume-backup-id ocid1.volumebackup.oc1.iad.nnn --destination-region sa-saopaulo-1\r\n+ v_target_volBackupJson='{\r\n  \"data\": {\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCASNPRDORADB01_U02_backup_20191027_203041\",\r\n    \"expiration-time\": null,\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.volumebackup.oc1.sa-saopaulo-1.iii\",\r\n    \"kms-key-id\": null,\r\n    \"lifecycle-state\": \"CREATING\",\r\n    \"size-in-gbs\": 310,\r\n    \"size-in-mbs\": 317440,\r\n    \"source-type\": \"MANUAL\",\r\n    \"source-volume-backup-id\": \"ocid1.volumebackup.oc1.iad.nnn\",\r\n    \"system-tags\": null,\r\n    \"time-created\": \"2019-10-27T20:30:57.562000+00:00\",\r\n    \"time-request-received\": \"2019-10-27T20:30:41.202000+00:00\",\r\n    \"type\": \"FULL\",\r\n    \"unique-size-in-gbs\": 0,\r\n    \"unique-size-in-mbs\": 0,\r\n    \"volume-id\": \"ocid1.volume.oc1.iad.ppp\"\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\nBackup status is CREATING. Please wait.\r\nBackup status is CREATING. Please wait.\r\nBackup status is CREATING. Please wait.\r\nBackup status is CREATING. Please wait.<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 18<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv volume-group-backup delete --volume-group-backup-id ocid1.volumegroupbackup.oc1.iad.jjj --force --wait-for-state TERMINATED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('TERMINATED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 19<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">++ oci --cli-rc-file \/dev\/null --region us-ashburn-1 bv volume-backup-policy-assignment get-volume-backup-policy-asset-assignment --asset-id ocid1.volume.oc1.iad.ppp\r\n++ jq -rc '.data[].\"policy-id\"'\r\n+ v_origVolBkpPolID=\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\n++ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 bv volume create --compartment-id ocid1.compartment.oc1..fff --display-name OCSPNPRDORADB01_U02 --availability-domain XkLK:SA-SAOPAULO-1-AD-1 --volume-backup-id ocid1.volumebackup.oc1.sa-saopaulo-1.iii --wait-for-state AVAILABLE --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('AVAILABLE',)\r\n+ v_target_volJson='{\r\n  \"data\": {\r\n    \"availability-domain\": \"XkLK:SA-SAOPAULO-1-AD-1\",\r\n    \"compartment-id\": \"ocid1.compartment.oc1..fff\",\r\n    \"defined-tags\": {},\r\n    \"display-name\": \"OCSPNPRDORADB01_U02\",\r\n    \"freeform-tags\": {},\r\n    \"id\": \"ocid1.volume.oc1.sa-saopaulo-1.hhh\",\r\n    \"is-hydrated\": false,\r\n    \"kms-key-id\": null,\r\n    \"lifecycle-state\": \"AVAILABLE\",\r\n    \"size-in-gbs\": 310,\r\n    \"size-in-mbs\": 317440,\r\n    \"source-details\": {\r\n      \"id\": \"ocid1.volumebackup.oc1.sa-saopaulo-1.iii\",\r\n      \"type\": \"volumeBackup\"\r\n    },\r\n    \"system-tags\": {},\r\n    \"time-created\": \"2019-10-27T22:00:59.268000+00:00\",\r\n    \"volume-group-id\": null\r\n  },\r\n  \"etag\": \"xxx\"\r\n}'\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 20<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 bv backup delete --volume-backup-id ocid1.volumebackup.oc1.sa-saopaulo-1.iii --force --wait-for-state TERMINATED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('TERMINATED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x\r\nCould not remove Target Volume Backup.<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 21<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">+ oci --cli-rc-file \/dev\/null --region sa-saopaulo-1 compute volume-attachment attach --instance-id ocid1.instance.oc1.sa-saopaulo-1.rrr --type iscsi --volume-id ocid1.volume.oc1.sa-saopaulo-1.hhh --is-read-only false --wait-for-state ATTACHED --max-wait-seconds 3600\r\nAction completed. Waiting until the resource has entered state: ('ATTACHED',)\r\n+ v_ret=0\r\n+ ((  1  ))\r\n+ set +x<\/pre>\n<p><span style=\"color: #008000;\"><strong>Executing Step 22<\/strong><\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">## IF YOUR INSTANCE IS LINUX, CONNECT AS OPC AND EXECUTE:\r\n## ================================================================================\r\nsudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:a9e0e239-a3a5-433b-b353-d4d0b74a7378 -p 169.254.2.2:3260 -u\r\nsudo iscsiadm -m node -o delete -T iqn.2015-12.com.oracleiaas:a9e0e239-a3a5-433b-b353-d4d0b74a7378 -p 169.254.2.2:3260\r\nsudo iscsiadm -m node -o new -T iqn.2015-12.com.oracleiaas:829d03f9-530a-4f74-9315-135d30c6d955 -p 169.254.2.2:3260\r\nsudo iscsiadm -m node -o update -T iqn.2015-12.com.oracleiaas:829d03f9-530a-4f74-9315-135d30c6d955 -n node.startup -v automatic\r\nsudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:829d03f9-530a-4f74-9315-135d30c6d955 -p 169.254.2.2:3260 -l\r\n## ================================================================================\r\n\r\nSCRIPT EXECUTED SUCCESSFULLY<\/pre>\n<p>Machine was successfully cloned to the target environment. Now the script will provide the ISCSI commands to detected the new Block Volumes, if the machine had any. Note that if I passed [-x], this step would be executed automatically using the opc account. A password-less connection with the account is needed in order to work.<\/p>\n<p><strong><span style=\"color: #008000;\">And that&#8217;s it. Machine is ready in new region.<\/span><\/strong><\/p>\n<h3>Some missing components<\/h3>\n<p>Note that some very specific things related to your compute, like a <strong>Network Security Groups <\/strong>association<strong>, <\/strong>that are not associated with the cloned instance as it relies on the object creation on the target. You will need to assign it manually.<\/p>\n<p>Hope this helps..<\/p>\n<b>Have you enjoyed? Please leave a comment or give a \ud83d\udc4d!<\/b>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style2 like-4359 jlk' href='javascript:void(0)' data-task='like' data-post_id='4359' data-nonce='de4404f630' rel='nofollow'><img class='wti-pixel' src='https:\/\/www.dbarj.com.br\/wp-content\/plugins\/wti-like-post\/images\/pixel.gif' title='Like' \/><span class='lc-4359 lc'>+1<\/span><\/a><\/div><\/div> <div class='status-4359 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Oracle is constantly releasing new regions around the globe for the Oracle Cloud Infrastructure, and geolocation is something very important for companies specially to achieve low latencies and high throughput. After those regions are out, I&#8217;ve been asked for some customers to move their existing computes from one region to another. After doing the same &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/\">Continue lendo<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-4359","post","type-post","status-publish","format-standard","hentry","category-oracle-cloud","item-wrap"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Automating clone of OCI compute instances across regions - DBA - Rodrigo Jorge - Oracle Tips and Guides<\/title>\n<meta name=\"description\" content=\"This article will show you how to easily clone oracle OCI compute instances across regions using a shellscript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"DBA RJ\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/\"},\"author\":{\"name\":\"DBA RJ\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#\\\/schema\\\/person\\\/28a44ca3a6633fe4156ad1ea209d40a9\"},\"headline\":\"Automating clone of OCI compute instances across regions\",\"datePublished\":\"2019-10-28T19:16:34+00:00\",\"dateModified\":\"2019-10-28T20:04:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/\"},\"wordCount\":1327,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#\\\/schema\\\/person\\\/28a44ca3a6633fe4156ad1ea209d40a9\"},\"articleSection\":[\"Oracle Cloud\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/\",\"url\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/\",\"name\":\"Automating clone of OCI compute instances across regions - DBA - Rodrigo Jorge - Oracle Tips and Guides\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#website\"},\"datePublished\":\"2019-10-28T19:16:34+00:00\",\"dateModified\":\"2019-10-28T20:04:09+00:00\",\"description\":\"This article will show you how to easily clone oracle OCI compute instances across regions using a shellscript.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/2019\\\/10\\\/automating-clone-of-oci-compute-instance-across-regions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automating clone of OCI compute instances across regions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#website\",\"url\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/\",\"name\":\"DBA - Rodrigo Jorge - Oracle Tips and Guides\",\"description\":\"Blog about Databases, Security and High Availability\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#\\\/schema\\\/person\\\/28a44ca3a6633fe4156ad1ea209d40a9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/pt-br\\\/#\\\/schema\\\/person\\\/28a44ca3a6633fe4156ad1ea209d40a9\",\"name\":\"DBA RJ\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/RodrigoJorgePOUG19.png\",\"url\":\"https:\\\/\\\/www.dbarj.com.br\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/RodrigoJorgePOUG19.png\",\"contentUrl\":\"https:\\\/\\\/www.dbarj.com.br\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/RodrigoJorgePOUG19.png\",\"width\":712,\"height\":712,\"caption\":\"DBA RJ\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.dbarj.com.br\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/RodrigoJorgePOUG19.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automating clone of OCI compute instances across regions - DBA - Rodrigo Jorge - Oracle Tips and Guides","description":"This article will show you how to easily clone oracle OCI compute instances across regions using a shellscript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/","twitter_misc":{"Escrito por":"DBA RJ","Est. tempo de leitura":"18 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/#article","isPartOf":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/"},"author":{"name":"DBA RJ","@id":"https:\/\/www.dbarj.com.br\/pt-br\/#\/schema\/person\/28a44ca3a6633fe4156ad1ea209d40a9"},"headline":"Automating clone of OCI compute instances across regions","datePublished":"2019-10-28T19:16:34+00:00","dateModified":"2019-10-28T20:04:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/"},"wordCount":1327,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/#\/schema\/person\/28a44ca3a6633fe4156ad1ea209d40a9"},"articleSection":["Oracle Cloud"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/","url":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/","name":"Automating clone of OCI compute instances across regions - DBA - Rodrigo Jorge - Oracle Tips and Guides","isPartOf":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/#website"},"datePublished":"2019-10-28T19:16:34+00:00","dateModified":"2019-10-28T20:04:09+00:00","description":"This article will show you how to easily clone oracle OCI compute instances across regions using a shellscript.","breadcrumb":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbarj.com.br\/pt-br\/2019\/10\/automating-clone-of-oci-compute-instance-across-regions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbarj.com.br\/pt-br\/"},{"@type":"ListItem","position":2,"name":"Automating clone of OCI compute instances across regions"}]},{"@type":"WebSite","@id":"https:\/\/www.dbarj.com.br\/pt-br\/#website","url":"https:\/\/www.dbarj.com.br\/pt-br\/","name":"DBA - Rodrigo Jorge - Oracle Tips and Guides","description":"Blog about Databases, Security and High Availability","publisher":{"@id":"https:\/\/www.dbarj.com.br\/pt-br\/#\/schema\/person\/28a44ca3a6633fe4156ad1ea209d40a9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbarj.com.br\/pt-br\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":["Person","Organization"],"@id":"https:\/\/www.dbarj.com.br\/pt-br\/#\/schema\/person\/28a44ca3a6633fe4156ad1ea209d40a9","name":"DBA RJ","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.dbarj.com.br\/wp-content\/uploads\/2019\/09\/RodrigoJorgePOUG19.png","url":"https:\/\/www.dbarj.com.br\/wp-content\/uploads\/2019\/09\/RodrigoJorgePOUG19.png","contentUrl":"https:\/\/www.dbarj.com.br\/wp-content\/uploads\/2019\/09\/RodrigoJorgePOUG19.png","width":712,"height":712,"caption":"DBA RJ"},"logo":{"@id":"https:\/\/www.dbarj.com.br\/wp-content\/uploads\/2019\/09\/RodrigoJorgePOUG19.png"}}]}},"_links":{"self":[{"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/posts\/4359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/comments?post=4359"}],"version-history":[{"count":3,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/posts\/4359\/revisions"}],"predecessor-version":[{"id":4366,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/posts\/4359\/revisions\/4366"}],"wp:attachment":[{"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/media?parent=4359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/categories?post=4359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbarj.com.br\/pt-br\/wp-json\/wp\/v2\/tags?post=4359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}