VMware Site Recovery provides customers with an easy and on-demand Disaster Recovery as-as-Service (DRaaS) for both their on-premises and VMware Cloud on AWS (VMC) workloads. DRaaS is one of the most popular VMware Cloud Service as it literally enables customers to setup a fully functional target DR site with just a click of a button, no joke!
As simple as this is, customers are also interested in automating the setup of DRaaS, especially for testing purposes. A couple of weeks back, I had a customer reach out asking if it was possible to automate the setup of DRaaS?
Funny enough, I just had this conversation a few weeks prior with the PM/Engineer and was in the process of looking into this. It turns out we do indeed have DRaaS Service API, which is what the VMC Console uses, however we had not publicized the API nor showed how to actually get more information about it. Do not worry, I have already feature request with the PM to not only get this published publicly but also show up as part of the VMC Developer Center API Explorer 🙂
The DRaaS Service API is pretty straight forward to use and there are only key three methods that are required for the basic DRaaS workflows. Below is a screenshot of the Swagger file, which can be downloaded using cURL as it requires authentication and you can use this shell script here to do so. Once downloaded, you can use any Swagger-based tool to view it, I use the Swagger Online Editor for this.
Rather than talking about how the DRaaS API works, lets take a look at an actual implementation! Similiar to VMC, VMC NSX-T and VMC HCX Community PowerCLI Module, I have also created a module for DRaaS which just contains three functions:
Step 1 - Connect to the VMC service and provide your VMC Organization Refresh Token, Name and SDDC Name by running the following commands:
$RefreshToken = "FILL-ME-IN"
$OrgName = "BashFest - Red Team"
$SDDCName = "SDDC-02"
Connect-VmcServer -RefreshToken $RefreshToken
Step 3 - Install the DRaaS Community PowerCLI Module and connect to the service by running the following commands:
Connect-DRaas -RefreshToken $RefreshToken -OrgName $OrgName -SDDCName $SDDCName
Step 4 - Once you have successfully connected, we can use the Get-DRaas function to get information about our DRaas deployment. If you have not activated DRaaS, you will get a message like the one shown below to use the Set-DRaas function to do so.
As shown in the output, this process will take some time as DRaaS will need to first connect to the DRaaS Content Library to import both the SRM/VR Virtual Appliance into your SDDC and then deploy and configure the appliances. You can use the VMC Console to monitor the progress, but we can also use the Get-DRaas function to do so which gives us more granular information about what is happening.
To determine when the deployment has completed, you will want to ensure that the DRaaSState is set to ACTIVATED and both the SRM and VR Node State have the READ value. In additon, you can also use this information to create Edge Firewall rules and retrieve the DRaaS URL for setting up SRM.