PowerCLI’s 11.5 was a big release for several reasons. One of those reasons is due to the introduction of some new cmdlets for use with the VMware Cloud on AWS service! These cmdlets are all high-level, which allows us to interact with our SDDCs in a much easier fashion than before.
The new cmdlets in the VMC module are:
- Get-VmcSddc
- Set-VmcSddc
- New-VmcSddc
- Remove-VmcSddc
- Add-VmcSddcHost
- Remove-VmcSddcHost
- Get-AwsAccount
- Get-AwsVpcSubnet
Let’s walk through how to use these within your own VMware Cloud on AWS Organization, as we manage each part of an SDDC’s lifecycle.
Creating New 1 Host SDDC
The first cmdlet we’ll walkthrough using is the one which creates a new SDDC, New-VmcSddc. This cmdlet requires fairly minimal information such as SDDC name, AWS region, and how many hosts the SDDC should have. We also have the ability to specify the management subnet CIDR as a parameter too, but that parameter is optional.
One big item of note, at the time of the PowerCLI 11.5 release, it can only provision one host SDDCs without an AWS account being linked. We do plan to improve the cmdlet in a future release to support all SDDC deployment configurations.
Here’s an example of creating a VMware Cloud on AWS single host SDDC where we don’t link an AWS account:
1 |
New-VmcSddc -Name KR-SDDC -Region US_EAST_1 -HostCount 1 -SkipAccountLinking |
Creating New 3-Host SDDC
We can also create a standard, 3 host or larger, SDDC which requires an AWS account be linked. There are two new cmdlets which simplifies this process from more than 10 lines of code down to 2 lines.
The first thing we’ll need to obtain, the AWS account we’ll be using. That information can be found with the following command:
1 |
Get-AwsAccount |
We’ll store that output in a variable and move on to the next step, which is to pick out our desired AWS VPC Subnet. We can use a single cmdlet to do this, however we will need to reference the AWS Account and which region the VPC should reside.
We can find the available VPC subnets with the following command:
1 |
Get-AwsVpcSubnet -AwsAccount $awsAcct -Region US_EAST_1 |
At this point, we have all the information needed to create our SDDC. With some minimal updates to the command from the previous section, we can create a new 3 host SDDC, have it linked to our AWS account, and using our requested VPC subnet with the following code:
1 |
New-VmcSddc -Name KR-SDDC -Region US_EAST_1 -HostCount 3 -AwsAccount $awsAcct -AwsVpcSubnet $vpcSub |
Viewing SDDC Information
We’ve created two SDDCs in the prior sections, now it’s time to find out what information about each of these SDDCs are available. The Get-VmcSddc cmdlet will turn several lines of API interaction into a single line.
We can find out some basic information about our newly created SDDCs with the following command:
1 |
Get-VmcSddc |
The above shows some great high-level information. However, if you’ve seen the API response, there’s a lot more information available to us. We can find some additional information about a particular SDDC by piping that command to Format-List. An example:
1 |
Get-VmcSddc | Format-List |
The above examples shows some important information, such as AWS region, how many hosts the SDDC has, what version the SDDC is on, and even the URL to reach the vCenter server. One thing you may notice is missing though, ExtensionData! This property, and all the information it provides us, is something that is not available at this point in time. We hope to add it in a future release.
In the meantime, you can take the information provided here and simplify the process to retrieve the rest of the properties which make up the SDDC object from the API level. An example to do that is as follows:
1 2 3 4 5 |
$vmcSddc = Get-VmcSddc -Name KR-SDDC-02 $orgId = $vmcSddc.Uid.Split('/')[2].Split('=')[1] $sddcId = $vmcSddc.Id $sddcSvc = Get-VmcService -Name com.vmware.vmc.orgs.sddcs $sddc = $sddcSvc.Get($orgId, $sddcId) |
Host Capacity Management
One of the amazing parts about a service such as VMware Cloud on AWS is that we can add and remove ESXi hosts to our SDDC in a matter of minutes! We now have two cmdlets to make the management of our ESXi hosts as simple as a one-liner.
We can add a single new host to our SDDC with the following command:
1 |
Add-VmcSddcHost -Sddc KR-SDDC-02 -HostCount 1 |
Similarly, we can also remove a single host from our SDDC with the following command:
1 |
Remove-VmcSddcHost -Sddc KR-SDDC-02 -HostCount 1 |
In the above examples you’ll also notice the flexibility to several different methods of input for each command, whether that be variables or even using a pipeline.
Removing SDDCs
Completing the lifecycle management of an SDDC is the removal of our created SDDC. Much like the prior create and retrieve cmdlets, we also have a cmdlet to delete an SDDC.
We can now remove our SDDC with the following command:
1 |
Remove-VmcSddc –Sddc KR-SDDC-02 |
More Updates
There are a couple other cmdlets worth discussing when it comes to using PowerCLI with VMware Cloud on AWS. One of the more popular requests was to rename an SDDC. This was recently enabled through the API and PowerCLI can also make this change in a high-level cmdlet.
We can update the name of our SDDC with the following command:
1 |
Set-VmcSddc -Sddc KR-SDDC-01 -Name KR-SDDC |
An existing cmdlet was also updated to help us out when it comes to retrieving, and even reporting, on tasks within our Organization. Get-Task now supports these VMC based tasks. If you’ve had a change to view the tasks for any given Organization, unlike vSphere tasks, they are available for quite a long time so the output could be unexpectedly longer than expected.
We can retrieve the tasks of our Organization with the following command:
1 |
Get-Task |
Each of these tasks are objects, so we can take one of those tasks and expand the available properties with Format-List by using the following command:
1 |
Get-Task | Select-Object -First 1 | Format-List |
Summary
The release of PowerCLI 11.5 added a ton of functionality when it comes to VMware Cloud on AWS. We can manage the entire lifecycle of an SDDC with high-level cmdlet. We can also pull task-based information from an existing cmdlet!
Update to the latest version of PowerCLI with the following command:
Let us know in the comments what cmdlets we should be adding next!