Cloud Migration Technical VMware Cloud on AWS

Automating HCX Add On for VMware Cloud on AWS

VMware HCX helps you migrate thousands of workloads to and from cloud environments with zero downtime. In this blog post, discover how to make workload migration even simpler by automating the deployment of HCX components to your SDDC with PowerShell.

.terminal {
border: 1px grey dashed;
padding: 10px;
background-color: whiteSmoke;
color: black;
font-family: “Lucida Console”, Monaco, monospace;
font-size: small;
line-height: 1.5;
}

Enabling Hybrid Cloud Extension (HCX) for a VMware Cloud on AWS SDDC is just a click of a button and is completely self-service which makes consuming the HCX Service extremely easy! All the hard work of deploying and configuring the required HCX infrastructure for your SDDC is completely automated for you by VMware when you click on “Deploy HCX” button.

Once the HCX infrastructure has been deployed in your SDDC, you can then deploy the respective HCX components for your on-premises vSphere environment which you can fully automate end-to-end which I have blogged about here.

Although the deployment of the HCX components for the SDDC is just click of a button, I recently had a need to automate this and I figure this would be a nice addition to my HCX PowerShell Community Module and complete the end-to-end story quite nicely from enabling the HCX Cloud Service to automating the deployment and configuration of the on-premises HCX components.

The HCX Cloud Service APIs is pretty straight forward which allows customers to enable the service and deploy to an SDDC, generate license keys for both HCX Cloud and Enterprise deployments and retrieving basic information about your account and SDDCs. To demonstrate the use of the HCX Cloud APIs, I have implemented the following 6 new PowerShell functions in my HCX Module:

  • Connect-HcxCloudServer
  • Get-HCXCloudSubscription
  • Get-HCXCloud
  • Get-HCXCloudActivationKey
  • New-HCXCloudActivationKey
  • Set-HCXCloud

 

Before we can use the functions, we need to authenticate to the HCX Cloud Service which is through the use of a CSP Refresh Token.

Here is an example of using the Connect-HCXCloudServer and your Refresh Token:

Connect-HCXCloudServer -RefreshToken $RefreshToken

Once connected, we can list all SDDCs for the given Organization using the Get-HCXCloud function:

In addition to the name, you will get the SDDC ID which is parameter required to deploy HCX to a specific SDDC but we can also see the current HCX Status and Region information, simliar to what you would see in the HCX Cloud Service UI.

For Subscription information and specifically when you need to generate a new license key, the Subscription ID (SID) is required and you can use the Get-HCXCloudSubscription function:

To request a new license key, simply use the New-HCXCloudActivationKey and provide the SID which can be found by using the previous command. You can also list all license keys and filter by usage by using the Get-HCXCloudActivationKey function.

So far, all of these functions are pretty granular based on the underlying HCX Cloud APIs. However, when it comes to enabling the deployment of HCX to an SDDC, from the UI standpoint, it is just a click. That is the user experience which I wanted to mimic from an Automation standpoint.

The Set-HCXCloud function actually encompasses the handling of the license request, so that you do not have to do it manually and the only input is the SDDC ID which can be retrieved from the Get-HCXCloud function.

Here is an example of enabling the HCX deployment for “SDDC-01” which did not have HCX enabled.

Set-HCXCloud -Activate -SDDCID $SDDCID

As indicated by the output above, the HCX deployment can take some time and you can either monitor the progress using the HCX Cloud Service UI

You can also retrieve the status by just using the Get-HCXCloud function as shown in the screenshot below.

With this final Automation in place, customers can now fully automate HCX deployments for VMC from enabling the service for an SDDC to fully deploying, configuring and associating the on-premises HCX components with the HCX Cloud instance!