To request the deployment of a cloud template, you use the Blueprint APIs to make a POST request with the cloud template ID as input.

The prerequisites of this task call for verifying that you have the cloud template ID of the cloud template you want to deploy. In addition, this procedure includes an optional step to deploy a cloud template without a cloud template ID by providing contents inline instead.

Prerequisites

Procedure

  1. Assign the cloud template ID variable.
    cloud_template_id='<your_cloud_template_id>'
  2. To deploy a cloud template, assign variables for image mapping and flavor mapping.
    image_mapping='<your_image_mapping_name>'
    flavor_mapping='<your_flavor_mapping_name>'
    

    The image mapping specifies the OS image for a VM. The flavor mapping specifies the CPU count and RAM of a VM.

  3. Request a deployment of a cloud template.
    curl -X POST \
      $url/blueprint/api/blueprint-requests?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" \
      -H 'Content-Type: application/json' \
      -d '{
        "description": "requesting deployment from cloud template",
        "blueprintId": "'"$cloud_template_id"'",
        "inputs": {
              "count": 2,
            "image":"'"$image_mapping"'",
            "flavor":"'"$flavor_mapping"'"
        }
    }' | jq "."
    
  4. Examine the response to get the cloud template request ID and the deployment ID.
  5. Assign the cloud template request ID and the deployment ID.
    cloud_template_request_id='<your_cloud_template_request_id>'
    deployment_id='<your_deployment_id>'
  6. (Optional) If you do not have a cloud template ID, you can also request a cloud template deployment with contents inline.
    1. Validate the cloud template before creating it.
      curl -X POST \
        $url/blueprint/api/blueprint-validation?apiVersion=$api_version \
        -H 'Content-Type: application/json' \
        -H "Authorization: Bearer $access_token"  \
        -d '{
          "name" : "'"$cloud_template_id"'",
          "description" : "Basic Cloud Machine cloud template",
          "content" : "formatVersion: 1\ninputs:\n  flavor:\n    type: string\n    title: Flavor\n    description: Flavor Mapping Name\n  image:\n    type: string\n    title: Image\n    description: Image Mapping Name\n  count:\n    type: integer\n    minimum: 1\n    default: 1\n    maximum: 2\n    title: Number of Instances\nresources:\n  BasicCloudMachine:\n    type: Cloud.Machine\n    properties:\n      name: BasicCloudMachine\n      flavor: '\''${input.flavor}'\''      \n      image: '\''${input.image}'\''\n      count: '\''${input.count}'\''",
          "projectId" : "'"$project_id"'",
          "requestScopeOrg": false
      }' | jq "."
    2. Examine the response to confirm that you see "valid":true.
    3. Request the cloud template deployment.
      curl -X POST \
        $url/blueprint/api/blueprint-requests \
        -H "Authorization: Bearer $access_token" \
        -H 'Content-Type: application/json' \
        -d '{
          "description": "requesting deployment from inline cloud template",
          "projectId": "'"$project_id"'",
          "inputs": {
                "count": "2",
              "image":"'"$image_mapping"'",
              "flavor":"'"$flavor_mapping"'"
          },
          "content" : "formatVersion: 1\ninputs:\n  flavor:\n    type: string\n    title: Flavor\n    description: Flavor Mapping Name\n  image:\n    type: string\n    title: Image\n    description: Image Mapping Name\n  count:\n    type: integer\n    minimum: 1\n    default: 1\n    maximum: 2\n    title: Number of Instances\nresources:\n  BasicCloudMachine:\n    type: Cloud.Machine\n    properties:\n      name: BasicCloudMachine\n      flavor: '\''${input.flavor}'\''      \n      image: '\''${input.image}'\''\n      count: '\''${input.count}'\''"
      }' | jq "."
  7. Look up the status of the cloud template deployment.
    curl -X GET \
      $url/api/blueprint-requests/$cloud_template_request_id?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."

Example: Deploy a Cloud Template

For a cloud template with ID 1f170637-81a3-4257-b1cd-b2219ee8034c, request the deployment with image mapping set to ubuntu and flavor mapping set to small.

Assign variables.

Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2019-09-12'
$ cloud_template_id='1f170637-81a3-4257-b1cd-b2219ee8034c'
$ image_mapping='ubuntu'
$ flavor_mapping='small'

Request the deployment of a cloud template.

$ curl -X POST \
  $url/blueprint/api/blueprint-requests?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" \
  -H 'Content-Type: application/json' \
  -d '{
    "description": "requesting deployment from cloud template",
    "blueprintId": "'"$cloud_template_id"'",
    "inputs": {
          "count": 2,
        "image":"'"$image_mapping"'",
        "flavor":"'"$flavor_mapping"'"
    }
}' | jq "."

A snippet of the response shows the cloud template request ID, the deployment ID, and the cloud template ID.

{  
  "id": "889f95a8-79a3-4b2f-b19e-32d1536dd69a",
  "createdAt": "2019-10-11T00:11:55.544Z",
...
  "projectName": "Example-project",  
  "deploymentId": "15454178-63fc-42ea-b4ad-7ed8a5cdb128",
  "requestTrackerId": "889f95a8-79a3-4b2f-b19e-32d1536dd69a",
...
  "blueprintId": "1f170637-81a3-4257-b1cd-b2219ee8034c",
...

Assign the cloud template request ID variable.

$ cloud_template_request_id='889f95a8-79a3-4b2f-b19e-32d1536dd69a'

Request the status of the deployment.

$ curl -X GET \
  $url/blueprint/api/blueprint-requests/$cloud_template_request_id?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" | jq "."

A snippet of the response shows the cloud template request ID and the cloud template ID with the status of the deployment request. If the deployment fails, the failure message indicates the reason for the failure.

{
  "id": "889f95a8-79a3-4b2f-b19e-32d1536dd69a"
  ...  
  "blueprintId": "1f170637-81a3-4257-b1cd-b2219ee8034c",
  "inputs": {
    "count": 2,
    "image": "ubuntu",
    "flavor": "small"
  },
  "status": "FINISHED",
...

What to do next

Use the deployment ID to look up resource information for your deployment.