Home > Blogs > VMware PowerCLI Blog > Tag Archives: VMWonAWS

Tag Archives: VMWonAWS

What’s New for the VMware Cloud on AWS Module

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:

Example: Creating a new 1-host SDDC

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:

Example: listing out an AWS account

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:

Example: List available AWS VPC subnets

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:

Example: New SDDC - 3 Hosts

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:

Example: List SDDCs

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:

Example: Detailed SDDC View

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:

Example: Retrieving all the SDDC information from the API

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:

Example: Add a new host to the SDDC

Similarly, we can also remove a single host from our SDDC with the following command:

Example: Removing a host from a SDDC

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:

Example: Remove SDDC

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:

Example: Update the name of an 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:

Example: Retrieve tasks

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:

Example: List additional properties of a task

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:
Example: Update to PowerCLI 11.5.0

Let us know in the comments what cmdlets we should be adding next!

New Release: PowerCLI Preview for VMware Cloud on AWS

It’s a big week for PowerCLI! We’re closing out 2018 with several new releases. The new PowerShell DSC Resources for VMware came out last week. PowerCLI 11.1.0 was released earlier today. Now, we also have a brand-new Fling to help bridge the gap between the low-level cmdlets already available and the high-level cmdlets that are so easy to use. The PowerCLI Preview for VMware Cloud on AWS adds 14 new high-level cmdlets which are used in combination with the existing VMware.VimAutomation.VMC module.

What do I mean by ‘high-level’ cmdlets? There are generally two forms of cmdlets available through PowerCLI, high-level and low-level. High-level cmdlets abstract the underlying API calls and provide an easy to use and understand cmdlet, like Get-SDDC. Based on that, you can assume the output will be SDDCs within your VMware Cloud on AWS environment. However, every API call does not have a corresponding high-level cmdlet and that’s where the low-level cmdlets come into play. Low-level cmdlets interact directly with the API and therefore have complete coverage of the available API calls. An example of a low-level cmdlet would be Get-View, or in the case of the VMC module it would be Get-VmcService. More information about the low-level cmdlet usage of the VMC module is available in the following blog post: Getting Started with the VMware Cloud on AWS Module

Why is this being released as a fling? Much like the NSX-T preview module released earlier this year, we’re trying a new approach to creating cmdlets based on the APIs. Essentially, we take the VMC API swagger specification and programmatically create the entire module. It’s early in this new development process and we know there is the potential for issues and things that may or may-not make sense.

Another reason for it being a fling, we need your feedback! What cmdlets are you using the most? What should the output look like? What cmdlets aren’t working the way you think they should? What cmdlets are missing? As well as any other feedback you can come up with! The preference is to leave the feedback on the Fling’s comments page. However, if you post it as a comment here, I’ll make sure the right people receive it.

With that said, let’s get started using this new module!

Getting Started

Before we dive right in, the following section is going to be using a Windows environment. However, both the existing VMC module as well as the new VMC Preview module are multi-platform and can be used with PowerShell Core!

First, we’ll need to head out to the VMware Flings site, browse for the fling and download the zip file. Direct link: PowerCLI Preview for VMware Cloud on AWS

Next, extract the module and place it into one of your $PSModule directories. Better yet, do it with PowerShell:

We can then verify the module was placed in the proper location and is available for us to use:

VMCPreview Module Install Process

Note: If you don’t see those two modules, you probably need to install the latest version of PowerCLI. Walkthroughs on how to do that are available:

Now that we can see the module, I would suggest browsing through the new cmdlets available. We can do that with the following command:

Listing the available commands

One last step before starting to use the new cmdlets, we need to authenticate to the VMware Cloud on AWS service. This requires the Connect-VMC cmdlet, which is available as part of the VMware.VimAutomation.VMC module, and our Refresh Token from the Account section of the VMware Cloud on AWS Cloud Console. We can then authenticate with the following command:

We are now authenticated and ready to start pulling information from the environment. Following along with the prior blog post, let’s start by pulling information about our organization. We can do that with the Get-Organization cmdlet.

Get-Organization Usage

We can clean up the output through the use of the Select-Object cmdlet with the following command:

Get-Organization Details

Another item we looked at in the last blog post, and the next logical step, SDDCs. The Get-Sddc cmdlet can be used, however it does require the addition of an Organization ID. I’ll store the Org ID from the prior step in a variable named orgId and then just jump to the cleaned-up view by using the following command to list the SDDC/s in the Org:

SDDC Example Output

Last thing I want to cover, these cmdlets make use of objects just like standard PowerCLI cmdlets do. Specific to the SDDC, we can access additional information such as what AWS Region and Availability Zone/s are in use, NSX information like the Manager URL (which will be important in a later blog post), and what the vCenter URL is. All of that information happens to be available in the ResourceConfig property of an SDDC. We can retrieve that information with the following command:

Additional SDDC Object Information

Summary

There’s a great new fling available called the PowerCLI Preview for VMware Cloud on AWS. This fling adds an additional 14 high-level cmdlets for VMware Cloud on AWS, like Get-Organization and Get-Sddc, which means that automating VMware Cloud on AWS has never been easier!

As with all of our Flings, please leave feedback on the Comments section! We want to know what you think. What cmdlets are you using the most? What should the output look like? What cmdlets aren’t working the way you think they should? What cmdlets are missing? As well as any other feedback you can come up with!