You can use the vRealize Automation REST API reservation service to create an Amazon reservation.

Prerequisites

  • Log in to vRealize Automation as a fabric group administrator.

  • Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.

  • If you are not using the API Explorer, verify that you have a valid HTTP bearer token that matches your login credentials. See REST API Authentication.

  • Display a list of the reservation types that are supported in the vRealize Automation server. See Display a List of Supported Reservation Types.

  • Obtain the permissible value field information required to create a new reservation. After you retrieve all permissible value field information, you have the input information required to create a reservation. See Get Resources Schema for a vSphere Reservation.

For the full list of tasks that you can perform before you create a reservation, see Create a Reservation.

Procedure

Create an Amazon reservation.
curl --insecure -H "Accept:application/json" 
-H "Authorization: Bearer $token" 
https://$host/reservation-service/api/reservations -d “
{
  "name": "TestEC2Reservation",
  "reservationTypeId": "Infrastructure.Reservation.Cloud.Amazon",
  "tenantId": "qe",
  "subTenantId": "a5d056be-3aa2-4fdd-ba1e-a3805f26f0e0",
  "enabled": true,
  "priority": 1,
  "reservationPolicyId": "34d2a612-718e-4814-96c5-225f7f5615a6",
  "alertPolicy": {
    "enabled": false,
    "frequencyReminder": 0,
    "emailBgMgr": true,
    "recipients": [
      
    ],
    "alerts": [
      {
        "alertPercentLevel": 80,
        "referenceResourceId": "machine",
        "id": "machine"
      }
    ]
  },
  "extensionData": {
    "entries": [
      {
        "key": "computeResource",
        "value": {
          "type": "entityRef",
          "componentId": null,
          "classId": "ComputeResource",
          "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554",
          "label": "EC2 841 Endpoint-us-east-1"
        }
      },
      {
        "key": "machineQuota",
        "value": {
          "type": "integer",
          "value": 0
        }
      },
      {
        "key": "securityGroups",
        "value": {
          "type": "multiple",
          "elementTypeId": "ENTITY_REFERENCE",
          "items": [
            {
              "type": "entityRef",
              "componentId": null,
              "classId": "AmazonSecurityGroup",
              "id": "10",
              "label": "default"
            }
          ]
        }
      },
      {
        "key": "loadBalancers",
        "value": {
          "type": "multiple",
          "elementTypeId": "ENTITY_REFERENCE",
          "items": [
            {
              "type": "entityRef",
              "componentId": null,
              "classId": "ElasticLoadBalancer",
              "id": "3",
              "label": "test1"
            }
          ]
        }
      },
      {
        "key": "locations",
        "value": {
          "type": "multiple",
          "elementTypeId": "ENTITY_REFERENCE",
          "items": [
            {
              "type": "entityRef",
              "componentId": null,
              "classId": "AvailabilityZone",
              "id": "10",
              "label": "us-east-1a"
            }
          ]
        }
      },
      {
        "key": "keyPairs",
        "value": {
          "type": "string",
          "value": "Per Provisioning Group"
        }
      }
    ]
  }
}”

The output is a sample location URL, including the new Amazon reservation ID.

Location: https://$host/reservation-service/api/reservations/3289b039-2a11-4ab4-a0bc-b583e4c6d085