Introduction
This document describes the procedure to create instance in Cisco CloudCenter (CCC) with the use of Application Programming Interface (API) Calls.
Prerequisites
Requirements
Cisco recommends that you have knowledge of these topics:
- Linux Interface
- Virtual Machine Environments
- Command Line Interface (CLI)
Components Used
The information in this document is based on these software versions:
- CCC Version 4.x
- CloudCenter Management (CCM)
- Manage API Access Key
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your system is live, make sure that you understand the potential impact of any command.
Create CCC API Key
Step 1. In CCM GUI, navigate to Admin > Users > Manage API Key (if the user doesn't have a Key, generate a new one).
Step 2. Copy the Key, save in a text file, and click Cancel.
Step 3. Create a file with the Instance information, for example, api_instance.json:
{
"name": "m3.medium",
"description": "General purpose(m3.medium)",
"type": "m3.medium",
"regionId": "1",
"costPerHour": 0.07,
"memorySize": 3840,
"numOfCpus": 1,
"numOfNics": 1,
"localStorageCount": 1,
"localStorageSize": 4,
"supportsCuda": false,
"supportsSsd": false,
"supports32Bit": false,
"supports64Bit": true,
"supportsHardwareProvision": false
}
Step 4. Identify your cloud region Admin> Cloud > Region: https://<hosts>/v1/tenants/1/clouds/1/regions/1/instanceTypes
Note: Replace <host> with your CCM address.
Step 5. From your CLI, where api_instance.json file is located, run the command:
curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" \
-u cliqradmin:803D197EFFC9A527 "https://<host>/v1/tenants/1/clouds/1/regions/1/instanceTypes" \
--data @api_instances.json
Note: Replace cliqradmin with your user.
Replace 803D197EFFC9A527 as your Key.
Replace api_isntaces.json with your file.
Replace <host> with your CCM address.
If everything is ok, the output from the CLI looks like:
user$ curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u cliqradmin:803D197EFFC9A527 "https://<hosts>0/v1/tenants/1/clouds/1/regions/1/instanceTypes" --data @api_instances.json
output
{"id":"6","resource":"https://10.31.127.20/v1/tenants/1/clouds/1/regions/1/instanceTypes/6","name":"db.m2.xlarge","description":"High-memory Extra Large DB Instance","type":"db.m2.xlarge","regionId":"1","costPerHour":0.555,"memorySize":17100,"numOfCpus":2,"numOfNics":1,"localStorageCount":0,"localStorageSize":420,"supportsCuda":false,"supportsSsd":false,"supports32Bit":false,"supports64Bit":true,"supportsHardwareProvision":false}
You have a new instance in your CCM GUI:
Related Information