To create a cloud zone, you first make GET request to obtain a region ID with a cloud account ID as input. Then you make a POST request with the region ID.
Prerequisites
- Verify that all general prerequisites have been satisfied. See Prerequisites for working with the Cloud Assembly APIs.
- Verify that you have the cloud account ID for the cloud account you added. See Add an AWS Cloud Account.
Procedure
Example: Create a Cloud Zone
Assign variables, specify a cloud account and look up IDs for the region named us-east-1 associated with the cloud account.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ cloud_account_id='c8c3c9bfdb449475-7f703c5265a63d87-f8e705d89b2569e1aac66c6d00bf4fc7ef4b1c44100f0e944af31eb8ba3d2a5a-f4226a20b65c4675574bc5fbff6c0'
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/regions/?apiVersion=$api_version&"'$filter'"=externalRegionId%20eq%20'us-east-1'%20and%20cloudAccountId%20eq%20'"$cloud_account_id"'" | jq "."
A snippet of the response from your request shows your cloud account ID with a region ID.
...
"externalRegionId": "us-east-1",
"cloudAccountId": "c8c3c9bfdb449475-7f703c5265a63d87-f8e705d89b2569e1aac66c6d00bf4fc7ef4b1c44100f0e944af31eb8ba3d2a5a-f4226a20b65c4675574bc5fbff6c0",
"id": "4965d34c3bfe0275574bc5fd858e8",
"updatedAt": "2022-04-02",
...
Specify a region ID and create a cloud zone.
$ region_id='4965d34c3bfe0275574bc5fd858e8' $ curl -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" -d '{ "name": "Demo-zone-1", "description": "This zone is for Demo", "regionId": "'$region_id'", "placementPolicy": "DEFAULT" }' "$url/iaas/api/zones?apiVersion=$api_version" | jq "."
A snippet of the response from your request shows the zone ID.
...
"name": "Aws / us-east-1",
"id": "4965d34c3bfe0275574bc5fd8782a",
"updatedAt": "2022-04-02",
...