One of the(many) great things about VMware Cloud on AWS, is the operational consistency it provides between your on-prem and public cloud environments. Be sure to check out this recent blog post for some more! Top 10 coolest features of VMware Cloud on AWS
For example, you can easily leverage tools such as PowerCLI to manage and automate your shiny new VMC on AWS SDDC. However to manage the VMC environment itself you’ll need an API Token(aka Refresh Token), rather than connect with the Connect-VIServer cmdlet.
In this post, you’ll see you how to leverage Code Sample’s within the Developer Center to get up and running quickly. We’ll download a sample script to export tasks from VMware Cloud on AWS to a CSV file. Which could be used for auditing purposes.
NOTE, these steps assume that you already have a SDDC deployed within VMC on AWS.
- First things first, login to https://console.cloud.vmware.com
- Launch VMware Cloud on AWS
- Click Developer Center, followed by Code Samples
- You will be presented with several code samples from various categories. e.g. PowerShell, Python, REST, Terraform etc. Within the Filter Samples search bar type export, then Download the Export VMC Tasks to CSV sample
- Now we need to need to get our API Token. In the top right, click the down arrow
next to your name in the top right hand corner, and My Account
- Click API Tokens. If you don’t already have a token, click New Token then Continue and one will be generated for you.
- This token will be used to authenticate to VMware Cloud on AWS via API. Click Copy to Clipboard
- Next, start a PowerCLI Session. If you don’t already have PowerCLI installed, start a PowerShell session and enter the following command to install directly from the PowerShell Gallery.
Install-Module -Name VMware.PowerCLI –Scope CurrentUser
- Install the VMC module
Install-Module -name VMware.VMC -scope CurrentUser
- Navigate to the directory where you downloaded the sample script, and run it
- You’ll be prompted for your Refresh Token, paste this in from your clipboard and press Enter. Type a path and filename where you want to export, and press Enter again
- Review the contents of the CSV. You’ll see the various tasks that have been performed at the VMC level
Optionally, take a look at the script to see how to connect with the API token.
Connect-Vmc -RefreshToken $RefreshToken
Take some time to take a look at some of the other Code Samples available.