Using VMware Cloud on AWS SDDC-Group APIs (Part 1)

Gilles Chekroun

Lead VMware Cloud on AWS Solutions Architect
Following the article on SDDC Grouping here, VMware has now a bunch of APIs to drive the VMware Transit Connect. 
All APIs documentation are in the VMware Cloud on AWS Developer Center 

API Explorer

The API Explorer tab has 3 main topics:
  • Cloud Services Platform
  • VMware Cloud
  • VMware Cloud on AWS
The Cloud Service Platform (CSP) is needed for User Authentication. The user needs to have a valid API Token to be able to generate a session token that can be used for API calls.
The API used for that is:
Note the "Base URL"
that needs to front end the API URL. This will exchange an ORG based API Token to a user access token that is needed for EVERY API call.

The VMware Cloud section is the one that we need for anything related to SDDC Grouping.
There are 2 sections:
  • Inventory
  • Network
The Inventory will allow you, for example, to get a list of SDDCs in that ORG using:
Note the "Base URL"
that here also, needs to front end any API URL.
You can execute the API call directly from the console.
WARNING - BE CAREFUL, all APIs executed from the API Explorer are done against your live environment, please execute with caution. 
Scrolling down will show you an EXECUTE Button and the API response in the console like:
Here we can see that we have 4 SDDCs in our ORG.
Every main section in the API response is expandable. For example if I click on Deployment (M15-SDDC), I will get more details about that SDDC.
The Network section is where we are going to focus for the SDDC Grouping.

Create an SDDC Group

To create an SDDC group and attach one or more SDDC, we need to use the following API:
Fill the requested body with a description, a name for the SDDC group and the SDDC ID or list of IDs to attach and click EXECUTE
This operation will create the SDDC Group and attach "M15-SDDC"

Asynchronous Operations

One VERY Important point is that the SDDC Group creation also create the VMware managed TGW and that takes time.
It is mandatory to check the Operation Completion and make sure it has a status of COMPLETED.
After every API call in that group, an "Operation ID" is returned.
To monitor the completion of the task, the following API should be used:
This API can NOT be used in the console since we don't have the "operation_id"
The "operation_id" is a parameter that is in the JSON response of the SDDC Group creation API and in fact with any VMC API call.
When using Python to call the APIs, it's simple to return the operation_id in the function. For example:
def create_sddc_group(name, deployment_id, org_id, session_token):
myHeader = {'csp-auth-token': session_token}
myURL = "{}/network/{}/core/network-connectivity-configs/
create-group-network-connectivity".format(BaseURL, org_id)
body = {
"name": name,
"description": name,
"members": [
"id": deployment_id
response =, json=body, headers=myHeader)
json_response = response.json()
task_id = json_response ['operation_id']
return task_id
The function returns the task_id which is the operation_id in the API JSON response
Then I am using another function that will loop on the status of the Task and wait for it to be "COMPLETED" or "FAILED"
def get_task_status(task_id, org_id, session_token):
myHeader = {'csp-auth-token': session_token}
myURL = "{}/operation/{}/core/operations/{}".format(BaseURL, org_id, task_id)
response = requests.get(myURL, headers=myHeader)
json_response = response.json()
status = json_response ['state']['name']
start = time.time()
while(status != "COMPLETED"):
response = requests.get(myURL, headers=myHeader)
json_response = response.json()
status = json_response ['state']['name']
if status == "FAILED":
print("\nTask FAILED ")
elapse = time.time() - start
minutes = elapse // 60
seconds = elapse - (minutes * 60)
print("\nFINISHED in", '{:02}min {:02}sec'.format(int(minutes), int(seconds)))

This will print dots "." every 2 seconds and stamp the total time it takes to complete.

% python 

Please give an argument like:

    create-sddc-group [name]

% python create-sddc-group SDDC-Group_API

=====Creating SDDC Group=========



FINISHED in 03min 33sec


Next Steps

I will add more functionality to the program that you can download here.

Thanks for reading.



AWS Transitive routing with Transit Gateways in the same region

Using Terraform with multiple providers in multiple phases to deploy and configure VMware Cloud on AWS

Peer VMware managed TGW to AWS TGW in multi-region and multi-accounts