Note:

Automate Full Stack Disaster Recovery with OCI CLI for a Cold Standby Topology

Introduction

Oracle Cloud Infrastructure Full Stack Disaster Recovery (Full Stack DR) provides a fully automated and comprehensive disaster recovery orchestration solution for all the layers of a full-stack cloud application, including infrastructure, database, and application. Using Full Stack DR, you can recover your full stack applications across OCI regions, or across availability domains within the same region.

Oracle Cloud Infrastructure Command Line Interface (OCI CLI) is a small-footprint tool that you can use on its own or with the Oracle Cloud Console to complete Oracle Cloud Infrastructure (OCI) tasks. The Command Line Interface (CLI) provides the same core functionality as the Oracle Cloud Console, plus additional commands. Some of these, such as the ability to run scripts, extend Console functionality.

The CLI is built on the OCI SDK for Python and runs on Mac, Windows, or Linux. The Python code makes calls to Oracle Cloud Infrastructure APIs to provide the functionality implemented for the various services. These are REST APIs that use HTTPS requests and responses.

Objectives

Automate the Full Stack Disaster Recovery steps using OCI Command Line Interface (CLI) for a Cold Standby Disaster Recovery topology.

Note: In this example,we will use FRANKFURT as Primary region and LONDON as Standby region.

Deployment Architecture

FSDR Architecture

Prerequisites

Implementation

For this tutorial, we have already created the following resources.

Resources Primary Region - Frankfurt
Object Storage Bucket FSDR_storage_primary_test
Compartment sathish.mahadev
Namespace frrudica1wgd
Instance memberId ocid1.instance…………………..
sourceVnicId ocid1.vnic.oc1……………………
Resources Standy Region - London
Object Storage Bucket FSDR_storage_secondary_test
Compartment sathish.mahadev
Namespace frrudica1wgd

Task 1: Create DR Protection Groups in Primary and Standby Region

  1. It is assumed, you have installed OCI CLI based on your preferred platform. We have installed OCI CLI on a OCI Linux VM. Set the OCI credentials and profile to connect to Frankfurt region.

  2. Below is the syntax for creating DR protection group.

    Usage:

    oci disaster-recovery dr-protection-group create [OPTIONS]
    

    Required Parameters:

    --compartment-id, -c [text]
    --display-name [text]
    --log-location [complex type]
    

    This is a complex type whose value must be valid JSON.

  3. Create JSON file with the following content and name it as log-location.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    {
      "bucket": "FSDR_storage_primary_test",
      "namespace": "frrudica1wgd"
    }
    
  4. Use the following command to create DR protection group in the Frankfurt region.

    oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Primary_test --log-location file://log-location.json
    

    CLI_FSDR_Primary

  5. You can verify the DR protection group details in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery, and Disaster Recovery Protection group. Status of the DR protection group should be Active.

    CLI_FSDR_Primary

  6. Set the OCI credentials and profile to connect to London region. Create JSON file with the following content and name it as log-sec-location.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    {
      "bucket": "FSDR_storage_secondary_test",
      "namespace": "frrudica1wgd"
    }
    
  7. Use the following command to create DR protection group in the London region.

    oci disaster-recovery dr-protection-group create --compartment-id ocid1.compartment.oc1............ --display-name CLI_FSDR_Secondry_test --log-location file://log-sec-location.json
    

    CLI_FSDR_Secondry

  8. You can verify the DR protection group details in the Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.

    CLI_FSDR_Secondry

Task 2: Associate DR Protection Groups

  1. Below is the syntax to associate the DR protection groups.

    Usage:

    oci disaster-recovery dr-protection-group associate [OPTIONS]
    

    Required Parameters:

    --dr-protection-group-id [text]
    --role [text]
    --peer-id [text]
    --peer-region [text]
    
  2. Create JSON file with the following content and name it as AssociateDrProtection.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    {
      "peerRegion": "uk-london-1",
      "peerId": "ocid1.drprotectiongroup.oc1.uk................................",
      "role": "PRIMARY"
    }
    
  3. Use the following command to create an association between two regions.

    oci disaster-recovery dr-protection-group associate --dr-protection-group-id ocid1.drprotectiongroup.oc1............ --from-json file://AssociateDrProtection.json
    

    AssociateDrProtection

    • Primary Region:

      You can verify the association between two regions in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.

      AssociateDrProtection

    • Standby Region:

      You can verify the association between two regions in the Standby region (Frankfurt) click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group.Status of the DR protection group should be Active.

      AssociateDrProtection

Task 3: Add members to the DR Protection Groups

Prerequisites

  1. Below is the syntax to add members to the DR protection group.

    Usage:

    oci disaster-recovery dr-protection-group update [OPTIONS]
    

    Required Parameters:

    --dr-protection-group-id [text]
    --members
    
  2. Create JSON file with the following content and name it as instance_members.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.If you have any advanced options in moving instance add the necessary properties.

    JSON file to add the members (compute and volume group) to the DR protection group.

    {
      "displayName": "CLI_FSDR_Primary",
            "members": [
          {
            "memberId": "ocid1.instance.oc1....................................",
            "memberType": "COMPUTE_INSTANCE",
            "isMovable": true,
            "vnicMapping": [
              {
                "sourceVnicId": "ocid1.vnic.oc1................................",
                "destinationSubnetId": "ocid1.subnet.oc1........................"
    
            }
          ],
          "destinationCompartmentId": "ocid1.compartment.oc1...................."
            },
    
        {
          "memberId": "ocid1.volumegroup.oc1...................................",
          "memberType": "VOLUME_GROUP"
            }],
    
            "logLocation": {
            "bucket": "FSDR_storage_primary",
            "namespace": "frrudixxxxx"
            }
    }
    
  3. Use the following command to add members to the DRPG.

    oci disaster-recovery dr-protection-group update --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://instance_members.json --force --debug
    

    AddMembers

  4. You can verify the updating DRPG work request status in the Primary region (Frankfurt), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Select CLI_FSDR_Primary_test and click Work requests.

    AddMembers

  5. You can verify Compute and Volume group resources are added successfully in the Primary region (Frankfurt) DRPG, click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, select CLI_FSDR_Primary_test and click Members.

    AddMembers

Task 4: Create Switchover Plan in the Standby region

  1. Below is the syntax for creating Switchover Plan.

    Usage:

    oci disaster-recovery dr-plan create [OPTIONS]
    

    Required Parameters:

    --dr-protection-group-id [text]
    --display-name [text]
    --type [text]
    
  2. Create JSON file with the following content and name it as CreateDrPlan.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    {
      "drProtectionGroupId": "ocid1.drprotectiongroup...........................",
      "displayName": "My_OCI_DR_Plan",
      "type": "SWITCHOVER"
    }
    
  3. Use the following command to create the switchover plan.

    oci disaster-recovery dr-plan create --dr-protection-group-id ocid1.drprotectiongroup.oc1..................................... --from-json file://CreateDrPlan.json
    

    CreateDrPlan

  4. You can verify the DR Plan in the Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, CLI_storage_secondary_test, and Plans.

    CreateDrPlan

Task 5: Customize the Switchover Plan with user defined plan groups

  1. Full Stack DR allows to create user defined plan groups to customize the DR plans.Get details for the DR plan identified by drPlanId which we have created in Task 4.

    oci disaster-recovery dr-plan get --dr-plan-id ocid1.drplan.oc1......... > dr-plan-get.json
    

    This will create a JSON file called dr-plan-get.json with the following content in the current working directory in the OCI Linux VM.

    {
      "data": {
        "compartment-id": "ocid1.compartment.oc1................................",
        "defined-tags": {
          "Oracle-Tags": {
            "CreatedBy": "oracleidentitycloudservice/sathish.mahadev@oracle.com",
            "CreatedOn": "2023-11-23T09:22:09.222Z"
          }
        },
        "display-name": "My OCI DR Plan",
        "dr-protection-group-id": "ocid1.drprotectiongroup.oc1.................",
        "freeform-tags": {},
        "id": "ocid1.drplan.oc1.eu-frankfurt-1.aaaaaaaacmfg3v..................",
        "life-cycle-details": null,
        "lifecycle-state": "ACTIVE",
        "peer-dr-protection-group-id": "ocid1.drprotectiongroup.oc1............",
        "peer-region": "uk-london-1",
        "plan-groups": [
          {
            "display-name": "Built-In Prechecks",
            "id": "sgid1.group..AwplAFAmPMSjruIpY8m2cw4v.......................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMvn4IpY8m...................",
                "id": "sgid1.step..PO9O2GisLb05WkUKebi4Hofc0...................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1.uk-london-1...................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMSjrPIH1zlApY...............",
                "id": "sgid1.step..IwKsQfyM6w78JcvklS2JulU2GdH6l...............",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1.uk-london-1.anw...............",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPMm2cw4v.....................",
                "id": "sgid1.step..XASO1rLLQkrsOUPN............................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_STOP_PRECHECK",
                "user-defined-step": null
              },
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmpY8m2cw4v....................",
                "id": "sgid1.step..VcHYP3vKNNTrg0gMYuw.........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "UNKNOWN_ENUM_VALUE",
                "user-defined-step": null
              },
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..AwplAFAmPY8m2cw4v....................",
                "id": "sgid1.step..wRdVq2t2d9It8P5TT2CvpMN7sy496o..............",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN_PRECHECK"
          },
          {
            "display-name": "Stop Compute Instances",
            "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9.....................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..XEqWbSZn72MsIKfP.....................",
                "id": "sgid1.step..GhvhuUwDXmyqaJe15ZrFc7......................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_STOP",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Switchover Volume Groups",
            "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM1j........................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..32adaPzUEQ7aH........................",
                "id": "sgid1.step..ef9UNZtJ1rZIbAmW7aZK........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_RESTORE_SWITCHOVER",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Launch Compute Instances",
            "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt............................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..5hcYKKlYT............................",
                "id": "sgid1.step..woJnsXF5wTpY3uf6M...........................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_LAUNCH",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Reverse Volume Groups' Replication",
            "id": "sgid1.group..zPThgbBHnakEowbozz57EWGg.......................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..zPThgbBHnakEo........................",
                "id": "sgid1.step..w5n1aGHFGCCWGtkfbm9U........................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_REVERSE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Terminate Compute Instances",
            "id": "sgid1.group..dfo08HuDTUIdkpt5l..............................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..dfo08H...............................",
                "id": "sgid1.step..7SMxaezWR5lYX...............................",
                "is-enabled": false,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_TERMINATE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Remove Compute Instances from DR Protection Group",
            "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4.........................",
            "steps": [
              {
                "display-name": "drtestwls-bastion-instance",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..pOeXUaXGLb1uhT.......................",
                "id": "sgid1.step..WilcZMUCDF42M0dhABNy........................",
                "is-enabled": true,
                "member-id": "ocid1.instance.oc1...............................",
                "timeout": 3600,
                "type": "COMPUTE_INSTANCE_REMOVE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Terminate Volume Groups",
            "id": "sgid1.group..FfcGwUBiibLFaYFfcnmHv2Q591.....................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..FfcGwUBiibLFaY.......................",
                "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOI.......................",
                "is-enabled": false,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_TERMINATE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          },
          {
            "display-name": "Remove Volume Groups from DR Protection Group",
            "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0frx.......................",
            "steps": [
              {
                "display-name": "fsdr_volume_group_test",
                "error-mode": "STOP_ON_ERROR",
                "group-id": "sgid1.group..RWQ1nwbf6JkIir.......................",
                "id": "sgid1.step..7bPFQyPkxXU4zaywzFNfp.......................",
                "is-enabled": true,
                "member-id": "ocid1.volumegroup.oc1............................",
                "timeout": 3600,
                "type": "VOLUME_GROUP_REMOVE",
                "user-defined-step": null
              }
            ],
            "type": "BUILT_IN"
          }
        ],
        "system-tags": {},
        "time-created": "2023-11-23T09:22:09.690000+00:00",
        "time-updated": "2023-11-24T06:25:43.748000+00:00",
        "type": "SWITCHOVER"
      },
      "etag": "b73b71668a7f52474c4c7df9c779d9c7aae77c27109be--gzip"
    }
    
    
  2. You can add user-defined groups and steps to a Disaster Recovery (DR) plan after Full Stack DR creates an initial DR plan with built-in groups and steps. You have option to use either script or OCI functions as part of user defined step. For more information,see OCI Full Stack Disaster Recovery User defined plan groups. User defined plan groups can be placed anywhere in the DR plan after the Built-In Prechecks plan group. In this tutorial, we are going to add our user defined plan group (CustGroup-Demo) add the end of the plan. The step will use a simple shell script to create folders and files once the compute instance is launched in the London region.

  3. Update the dr-plan-get.json which was created in previous step to add a user defined plan group with a step in the end of the file content to the existing plans groups and rename the file dr-plan-get.json as dr-plan-get_updated.json.

    Finally JSON file looks like below after adding the new user defined group.

     [
         {
             "display-name": "Built-In Prechecks",
             "id": "sgid1.group..AwplAFAmPMSjrPIH1zlAIqu....................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmP....................",
                     "id": "sgid1.step..PO9O2GisLb05WkUKeb..................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_LAUNCH_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSj.................",
                     "id": "sgid1.step..IwKsQfyM6w78JcvklS2.................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_REMOVE_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSjrP...............",
                     "id": "sgid1.step..XASO1rLLQk2GfJjKYlOf5...............",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_STOP_PRECHECK",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPMSjrP...............",
                     "id": "sgid1.step..VcHYP3vKNNTr6Ha5CB..................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "UNKNOWN_ENUM_VALUE",
                     "user-defined-step": null
                 },
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..AwplAFAmPM...................",
                     "id": "sgid1.step..wRdVq2..............................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_RESTORE_SWITCHOVER_PRECHECK",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN_PRECHECK"
         },
         {
             "display-name": "Stop Compute Instances",
             "id": "sgid1.group..XEqWbSZn72MsIKfPAPh2cdBah9F1rW.............",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..XEqWbSZn72Ms.................",
                     "id": "sgid1.step..GhvhuUwDXmyqaJe1....................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_STOP",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Switchover Volume Groups",
             "id": "sgid1.group..32adaPzUEQ7aH1uDWQ5VM......................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..32adaPzUEQ7aH1uD.............",
                     "id": "sgid1.step..ef9UNZtJ1rZ.........................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_RESTORE_SWITCHOVER",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Launch Compute Instances",
             "id": "sgid1.group..5hcYKKlYTRiBwIDJcbt3mxvA...................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..5hcYKKlYTRi..................",
                     "id": "sgid1.step..woJnsXF5wTpY3.......................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_LAUNCH",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Reverse Volume Groups' Replication",
             "id": "sgid1.group..zPThgbBHnakEowbozz57EW4vAdM9O",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..zPThgbBH.....................",
                     "id": "sgid1.step..w5n1aGHFGCCWGtk.....................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_REVERSE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Terminate Compute Instances",
             "id": "sgid1.group..dfo08HuDTUIdkpt5loA5zB.....................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..dfo08HuDTUIdkpt5lo...........",
                     "id": "sgid1.step..7SMxaezWR5lYXQ......................",
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_TERMINATE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Remove Compute Instances from DR Protection Group",
             "id": "sgid1.group..pOeXUaXGLb1uhTQRwSJEB4Yw...................",
             "steps": [
                 {
                     "display-name": "drtestwls-bastion-instance",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..pOeXUaXGLb1..................",
                     "id": "sgid1.step..WilcZMUCDF42M0dhAB..................",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "COMPUTE_INSTANCE_REMOVE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Terminate Volume Groups",
             "id": "sgid1.group..FfcGwUBiibLFaYZvHEUmQRDSd..................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..FfcGwUBiibLFaYFfcnmH.........",
                     "id": "sgid1.step..wipkZ4tXRQaIxJ0bAWzOINqf............",
                     "is-enabled": false,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_TERMINATE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "Remove Volume Groups from DR Protection Group",
             "id": "sgid1.group..RWQ1nwbf6JkIir5vMOgz0Eti...................",
             "steps": [
                 {
                     "display-name": "fsdr_volume_group_test",
                     "error-mode": "STOP_ON_ERROR",
                     "group-id": "sgid1.group..RWQ1nwbf6JkIir...............",
                     "id": "sgid1.step..7bPFQyPkxXU4zaywzFN.................",
                     "is-enabled": true,
                     "member-id": "ocid1.volumegroup.oc1....................",
                     "timeout": 3600,
                     "type": "VOLUME_GROUP_REMOVE",
                     "user-defined-step": null
                 }
             ],
             "type": "BUILT_IN"
         },
         {
             "display-name": "CustGroup-Demo",
             "steps": [
                 {
                     "display-name": "Create Folder and Files under /home/opc",
                     "error-mode": "CONTINUE_ON_ERROR",
                     "is-enabled": true,
                     "member-id": "ocid1.instance.oc1.......................",
                     "timeout": 3600,
                     "type": "USER_DEFINED",
                     "user-defined-step": {
                         "run-as-user": "opc",
                         "run-on-instance-id": "ocid1.instance.oc1..........",
                         "run-on-instance-region": "uk-london-1",
                         "script-command": "/home/opc/scripts/testCommand.sh",
                         "step-type": "RUN_LOCAL_SCRIPT"
                     }
                 }
             ],
             "type": "USER_DEFINED"
         }
     ]
    
    
  4. Use the command to update the DR plan identified by drPlanId by using newly updated dr-plan-get_updated.json file.

    oci disaster-recovery dr-plan update --dr-plan-id ocid1.drplan.oc1.eu-frankfurt-1.aaaajfq --from-json file://dr-plan-get_updated.json --debug
    
  5. You can verify newly created user defined group on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions, and My_OCI_DR_Plan.

    userDefinedPlanGroup

Task 6: Execute prechecks for the Switchover Plan in the Standby region

  1. Below is the syntax to execute prechecks for the Switchover Plan.

    Usage:

    oci disaster-recovery dr-plan-execution create-switchover-precheck [OPTIONS]
    

    Required Parameters:

    --plan-id [text]
    
  2. Create JSON file with the following content and name it as PrecheckExecution.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    {
      "displayName": "My_OCI_DR_Plan",
      "planId": "ocid1.drplan.oc1.............................................",
      "executionOptions": {
        "planExecutionType": "SWITCHOVER_PRECHECK"
      }
    }
    
    
  3. Use the following command to execute prechecks for the Switchover Plan on Standby region (London).

    oci disaster-recovery dr-plan-execution create-switchover-precheck --from-json file://PrecheckExecution.json --debug
    

    createSwitchoverPrecheck

  4. You can verify switchover precheck status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions, and My OCI DR Plan.

    createSwitchoverPrecheck

Task 7: Execute the Switchover Plan in the Standby region (London)

  1. Below is the syntax for executing the Switchover Plan.

    Usage:

    oci disaster-recovery dr-plan-execution create-switchover [OPTIONS]
    

    Required Parameters:

    --plan-id [text]
    
  2. Create JSON file with the following content and name it as SwitchoverExecution.json. Save the file in the preferred location, we have stored the file in the current working directory in the OCI Linux VM.

    JSON file for Association

    {
      "displayName": "executeDRplan",
      "planId": "ocid1.drplan.oc1.............................................",
      "executionOptions": {
        "planExecutionType": "SWITCHOVER"
      }
    }
    

    Use the following command to execute DR Plan.

    oci disaster-recovery dr-plan-execution create --from-json file://SwitchoverExecution.json --debug
    

    DRPlanExecution

    DRPlanExecution

  3. You can verify plan execution status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, and click Plan executions.

    DRPlanExecution

  4. You can verify DR plan execution status on Standby region (London), click the Hamburger menu, go to Migration & Disaster Recovery, Disaster Recovery Protection group, Plan executions and click ExecuteDRplan.

    DRPlanExecution

Next Steps

You have seen how to use OCI CLI commands to create DR protection groups, associate, add members, create DR plan, execute prechecks and DR plan. Use OCI CLI for performing various Full Stack DR lifecycle operations at scale for your buisness systems.

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.