To create an image mapping, you make a POST request with a region ID associated with a cloud account. The cloud account can be an AWS, vSphere, Azure, or GCP cloud account.
Cloud vendors use images to configure a VM based on OS settings, such as an ubuntu-16 configuration. When you build a cloud template, you pick an image that fits your needs and map an image name to a value for each account or region. You can also add constraints and configuration scripts to further control resource placement.
The same API calls create an image profile for an AWS, vSphere, Azure, or GCP cloud account.
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 new cloud account that you added. See Adding Cloud Accounts.
Procedure
Example: Create image mapping
$ url='https://appliance.domain.com''
$ api_version='2021-07-15'
$ cloud_account_id='c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c4033013bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d'
Look up region IDs associated with the cloud account and in the external region ID us-east-1.
$ 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 shows the region ID.
...
"externalRegionId": "us-east-1",
"cloudAccountId": "c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c4033013bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d",
"id": "37d6c1acf4a8275586468873c739",
"updatedAt": "2022-04-02",
...
Assign the region ID.
$ region_id='37d6c1acf4a8275586468873c739'
List all fabric images based on the name ubuntuserver.
curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-images/?apiVersion=$api_version&"'$filter'="name%20eq%20'*ubuntuserver*latest'%20or%20externalId%20eq%20ami-a8d2d7ce" | jq "."
A snippet of the response shows a fabric image ID. Select the IDs that you want.
...
"osFamily": "Linux",
"externalRegionId": "francecentral",
"isPrivate": false,
"externalId": "Canonical:UbuntuServer:16.04-LTS:latest",
"name": "Canonical:UbuntuServer:16.04-LTS:latest",
"description": "Canonical:UbuntuServer:16.04-LTS:latest",
"id": "fa13cb9367b63e755734f761858d8",
"updatedAt": "2022-04-02",
...
Create an image profile named example-image-profile.
$ curl -X POST \ $url/iaas/api/image-profiles?apiVersion=$api_version \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "name":"example-image-profile", "description":"Example image profile", "imageMapping": { "ubuntu": { "id": "fa13cb9367b63e755734f761858d8" }, "ubuntu16": { "id": "fa13cb9367b63e755734f761858d8" } }, "regionId":"'$region_id'" }' | jq "."
A snippet of the response shows the image profile ID.
...
"externalRegionId": "us-east-1",
"name": "example-image-profile",
"description": "Example image profile",
"id": "c70c0677a8e3787558edac19c9b10",
"updatedAt": "2022-04-02",
...