To create a flavor 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 flavors, or instance types, to express standard deployment sizings such as small (1 CPU, 2 GB RAM) or large (2 CPU, 8 GB RAM) for compute resources. When you build a cloud template, you pick a flavor that fits your needs and map a flavor name to a value for each account or region.

The same API calls create a flavor profile for an AWS, vSphere, Azure, or GCP cloud account. However, the flavor mapping used to create the flavor profile varies for each type of cloud account. This procedure provides the steps to create a flavor profile for an AWS cloud account. Additional examples show how to create flavor profiles for vSphere and Azure cloud accounts.

Prerequisites

  • Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
  • Verify that you have the cloud account ID for the new cloud account that you added. See Adding Cloud Accounts.

Procedure

  1. Assign the cloud account ID variable.
    cloud_account_id='<your_cloud_account_id>'
  2. 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 "."
  3. Examine the response to find the ID for the region that you want.
  4. Assign the region ID variable.
    region_id='<your_region_id>'
  5. List all fabric flavors.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-flavors/?apiVersion=$api_version" | jq "."
  6. To select fabric flavor names with resources that fit your needs, examine the response.
  7. Create a flavor profile for an AWS account that uses the fabric flavor names in your flavor mapping.
    curl -X POST \
      $url/iaas/api/flavor-profiles?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "name":"<your_flavor_profile>",
        "description":"Example AWS Compute flavors",
        "flavorMapping": {
          "small": {
            "name":"<flavor_name1_from_response>"
          },
          "medium": {
            "name":"<flavor_name2_from_response>"
          },
          "large":{
            "name":"<flavor_name3_from_response>"
          }
        },
        "regionId":"'$region_id'"
      }' | jq "."
  8. To obtain the flavor profile ID, examine the response.
  9. Assign the flavor profile ID variable.
    flavor_profile_id='<your_flavor_profile_id>'
  10. (Optional) Look up the flavor profile you created with your flavor profile ID.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" $url/iaas/api/flavor-profiles/$flavor_profile_id?apiVersion=$api_version | jq "."
    The response shows the name and ID for the flavor profile you created.
    Note: Using the external region ID and the cloud account ID, you can also filter for the flavor profile with a query that does not require the flavor profile ID. See Filtering Resources by Region ID.

Example: Create flavor mappings for different cloud accounts

Create a flavor mapping for an AWS cloud account.

  1. Assign the required variables including the cloud account ID for an AWS cloud account.
    $ url='https://appliance.domain.com'
    $ api_version='2021-07-15'
    $ cloud_account_id='c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c403301
    3bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d'
  2. 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",
    ...
  3. Assign the AWS region ID.
    $ aws_region_id='37d6c1acf4a8275586468873c739'
  4. List all fabric flavors.
    $ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-flavors/?apiVersion=$api_version" | jq "."

    A snippet of the response shows a fabric flavor name with its resource size.

    ...      
        {
          "id": "t2.micro",
          "name": "t2.micro",
          "cpuCount": 1,
          "memoryInMB": 1024,
          "storageType": "EBS",
          "networkType": "Low to Moderate"
        },
    ...
  5. Select fabric flavor names with resources that fit your needs and create an AWS flavor profile named aws-flavor-profile.
    $ curl -X POST \
      $url/iaas/api/flavor-profiles?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "name":"aws-flavor-profile",
        "description":"Example AWS Compute flavors",
        "flavorMapping": {
          "small": {
            "name":"t2.micro"
          },
          "medium": {
            "name":"t2.medium"
          },
          "large":{
            "name":"t2.large"
          }
        },
        "regionId":"'$aws_region_id'"
      }' | jq "."

    A snippet of the response shows the flavor profile ID.

    ...      
      "externalRegionId": "us-east-1",
      "name": "aws-flavor-profile",
      "description": "Example AWS Compute flavors",
      "id": "835249077934b47558eca5963e068",
      "updatedAt": "2022-04-02",
    ...

Create a flavor mapping for a vSphere cloud account.

  1. Assign the required variables including the cloud account ID for a vSphere cloud account.
    $ url='https://appliance.domain.com'
    $ api_version='2021-07-15'
    $ cloud_account_id='c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c403301
    3bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d'
  2. Look up region IDs associated with the cloud account and in the external region ID Datacenter:datacenter-2.
    $ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/regions/?apiVersion=$api_version&"'$filter'"=externalRegionId%20eq%20'Datacenter:datacenter-2'%20and%20cloudAccountId%20eq%20'"$cloud_account_id"'"  | jq "."

    A snippet of the response shows the region ID.

    ...      
          "externalRegionId": "Datacenter:datacenter-2",
          "cloudAccountId": "c8c3c9bfdb449475-7f703c5265a63d87-d06bf79904ce5096492a2a2fc557fb0457d7d3c5b5e7ae20b29957788812bb3d-d5a5e16bdc3eec7557245925e1b08",
          "id": "2aaf79b789eee8755724592b06d39",
          "updatedAt": "2022-04-02",
    ...
  3. Assign the vSphere region ID.
    $ vsphere_region_id='2aaf79b789eee8755724592b06d39'
  4. Create a vSphere flavor profile named vcenter-flavor-profile.
    $ curl -X POST \
      $url/iaas/api/flavor-profiles?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "name":"vcenter-flavor-profile",
        "description":"Example vSphere Compute flavors",
        "flavorMapping": {
          "small": {
            "cpuCount":1,
            "memoryInMB": 1024
          },
          "medium": {
            "cpuCount":2,
            "memoryInMB": 2048
          },
          "large":{
            "cpuCount":4,
            "memoryInMB": 4096
          }
        },
        "regionId":"'$vsphere_region_id'"
      }' | jq "."

    A snippet of the response shows the flavor profile ID.

    ...      
      "externalRegionId": "Datacenter:datacenter-2",  
      "name": "vcenter-flavor-profile",
      "description": "Example vSphere Compute flavors",
      "id": "cfb7246505319275572e9e68372d0",
      "updatedAt": "2022-04-02",
    ...

Create a flavor mapping with an Azure cloud account ID.

  1. Assign the required variables including the cloud account ID for an Azure cloud account.
    $ url='https://appliance.domain.com'
    $ api_version='2021-07-15'
    $ cloud_account_id='c8c3c9bfdb449475-7f703c5265a63d87-5fa34c478df36b060e1ca3551254c403301
    3bf3283908e4661cd1c6fb2f8b9ae-ce5aad01092b47558644f6b6615d'
  2. 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",
    ...
  3. Assign the Azure region ID.
    $ azure_region_id='37d6c1acf4a8275586468873c739'
  4. List all fabric flavors.
    $ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/fabric-flavors/?apiVersion=$api_version" | jq "."

    A snippet of the response shows a fabric flavor name with its resource size.

    ...      
        {
          "id": "Standard_A0",
          "name": "Standard_A0",
          "cpuCount": 1,
          "memoryInMB": 768,
          "bootDiskSizeInMB": 1047552,
          "dataDiskSizeInMB": 20480,
          "dataDiskMaxCount": 1
        },
    ...
  5. Select fabric flavor names with resources that fit your needs and create an Azure flavor profile named azure-flavor-profile.
    $ curl -X POST \
      $url/iaas/api/flavor-profiles?apiVersion=$api_version \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "name":"azure-flavor-profile",
        "description":"Example Azure Compute flavors",
        "flavorMapping": {
          "small": {
            "name":"Standard_A0"
          },
          "medium": {
            "name":"Standard_A1"
          },
          "large":{
            "name":"Standard_A2"
          }
        },
        "regionId":"'$azure_region_id'"
      }' | jq "."

    A snippet of the response shows the flavor profile ID.

    ...      
      "externalRegionId": "us-east-1",
      "name": "azure-flavor-profile",
      "description": "Example Azure Compute flavors",
      "id": "4965d34c3bfe0275574bc6e505b78",
      "updatedAt": "2022-04-02",
    ...