This simple walkthrough shows how to deploy in a scenario where only virtual datacenters exist. The user role in this example is a plain user. The privileges needed are displayed for every query.
Privileges Required
VDC_ENUMERATE
VAPP_CUSTOMISE_SETTINGS
ENTERPRISE_ENUMERATE
VDC_MANAGE_VAPP
VAPP_DEPLOY_UNDEPLOY
AUTHENTICATED
Preparation
First we retrieve the virtual datacenter that will be used. From this we will need the links with rel enterprise and virtualappliances. We will create a new virtual appliance in the virtual datacenter. And we also need the hypervisorType of the virtual datacenter.
Then we will retrieve the enterprise, in order to access the repository and the virtual machine templates for the hypervisor of the virtual datacenter. To create the new virtual machine, we will take the virtual appliance and add the templates for the new virtual machines.
Get all Virtual Datacenters
API Roles required
* This action requires the privileges AUTHENTICATED, VDC_ENUMERATE
cURL:
curl -X GET https://example.com/api/cloud/virtualdatacenters \ -H 'Accept:application/vnd.abiquo.virtualdatacenters+json;version=4.2' \ -u user:password --verbose
Success status code: 200
Request payload:
--none--
Response payload:
The response to this query is a collection of virtual datacenters..
{ "links": [ { "rel": "first", "href": "https://example.com:443/api/cloud/virtualdatacenters?limit=25&by=name&asc=true" }, { "rel": "last", "href": "https://example.com:443/api/cloud/virtualdatacenters?startwith=0&limit=25&by=name&asc=true" } ], "collection": [ { "id": 490, "hypervisorType": "AMAZON", "name": "vdc_m01j", "network": { "id": 572, "name": "default_private_network", "address": "192.168.0.0", "mask": 24, "gateway": "192.168.0.1", "primaryDNS": "10.60.1.4", "secondaryDNS": "8.8.8.8", "sufixDNS": "", "defaultNetwork": false, "type": "INTERNAL", "dhcpOptions": { "links": [], "collection": [] }, "ipv6": false, "strict": false, "providerId": "subnet-6a292931", "restricted": false, "internetGatewayRole": false, "ipRanges": [ { "firstIp": "192.168.0.5", "lastIp": "192.168.0.253" } ], "excludedFromFirewall": false, "links": [ { "title": "vdc_m01j", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490" }, { "title": "default_private_network", "rel": "edit", "type": "application/vnd.abiquo.vlan+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572" }, { "title": "ips", "rel": "ips", "type": "application/vnd.abiquo.privateips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/ips" }, { "title": "eu-west-1c", "rel": "availabilityzone", "type": "application/vnd.abiquo.availabilityzone+json", "href": "https://example.com:443/api/cloud/locations/2/availabilityzones/eu-west-1c" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/loadbalancers" }, { "title": "configuration", "rel": "configuration", "type": "application/vnd.abiquo.networkconfiguration+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/configuration" }, { "title": "192.168.0.0/24", "rel": "network_configuration", "type": "application/vnd.abiquo.networkconfiguration+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572/configuration/572" } ] }, "providerId": "vpc-04df7462", "syncState": "NONE", "links": [ { "title": "vdc_m01j", "rel": "edit", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490" }, { "title": "private networks", "rel": "privatenetworks", "type": "application/vnd.abiquo.vlans+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks" }, { "title": "public networks", "rel": "network", "type": "application/vnd.abiquo.vlans+json", "href": "https://example.com:443/api/admin/datacenters/2/network" }, { "title": "default_private_network", "rel": "defaultvlan", "type": "application/vnd.abiquo.vlan+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/privatenetworks/572" }, { "title": "AWS_enterprise_forBilling", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://example.com:443/api/admin/enterprises/65" }, { "title": "virtual appliances", "rel": "virtualappliances", "type": "application/vnd.abiquo.virtualappliances+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances" }, { "title": "private ips", "rel": "privateips", "type": "application/vnd.abiquo.privateips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/privateips" }, { "title": "external ips", "rel": "externalips", "type": "application/vnd.abiquo.externalips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/externalips" }, { "title": "unmanaged ips", "rel": "unmanagedips", "type": "application/vnd.abiquo.unmanagedips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/unmanagedips" }, { "title": "default vlan", "rel": "defaultvlan", "type": "application/vnd.abiquo.vlan+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/defaultvlan" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/volumes" }, { "title": "disks", "rel": "disks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/disks" }, { "title": "ips to purchase", "rel": "topurchase", "type": "application/vnd.abiquo.publicips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/publicips/topurchase" }, { "title": "ips purchased", "rel": "purchased", "type": "application/vnd.abiquo.publicips+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/publicips/purchased" }, { "title": "stateful volumes", "rel": "statefulcandidates", "type": "application/vnd.abiquo.volumes+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/volumes/action/statefulcandidates" }, { "title": "tiers", "rel": "tiers", "type": "application/vnd.abiquo.tiers+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/tiers" }, { "title": "available templates", "rel": "templates", "type": "application/vnd.abiquo.virtualmachinetemplates+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates" }, { "title": "all virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/virtualmachines" }, { "title": "eu-west-1", "rel": "region", "type": "application/vnd.abiquo.region+json", "href": "https://example.com:443/api/config/hypervisortypes/AMAZON/regions/eu-west-1" }, { "title": "amazon-device", "rel": "device", "type": "application/vnd.abiquo.device+json", "href": "https://example.com:443/api/cloud/locations/2/devices/1" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.firewallpolicies+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/loadbalancers" }, { "title": "000AmazonDC-IReland", "rel": "location", "type": "application/vnd.abiquo.publiccloudregion+json", "href": "https://example.com:443/api/cloud/locations/2" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/tasks" }, { "title": "location limit", "rel": "limit", "type": "application/vnd.abiquo.limit+json", "href": "https://example.com:443/api/admin/enterprises/65/limits/199" }, { "title": "externalnetworks", "rel": "externalnetworks", "type": "application/vnd.abiquo.vlans+json", "href": "https://example.com:443/api/admin/enterprises/65/limits/199/externalnetworks" }, { "title": "virtual appliances specs", "rel": "vappspecs", "type": "application/vnd.abiquo.virtualappliancespecs+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/vappspecs" } ], "diskSoftLimitInMb": 0, "diskHardLimitInMb": 0, "storageSoftInMb": 0, "storageHardInMb": 0, "vlansSoft": 0, "vlansHard": 0, "publicIpsSoft": 0, "publicIpsHard": 0, "ramSoft": 0, "ramHard": 0, "cpuSoft": 0, "cpuHard": 0 } ], "totalSize": 1 }
A virtual datacenter contains virtual appliances. It is the root resource of all the virtual appliances that belong to that virtual datacenter. The Abiquo UI automatically creates a VApp when you create or synchronize a VDC, but if you use the API to create the VDC, you will need to create your own VApp from the virtualappliances link. The only data you need to supply is the name, and of course you can supply an optional icon.
Optionally create a Virtual Appliance
API Roles required:
* This action requires the privilege VDC_MANAGE_VAPP
cURL:
curl -X POST https://example.com/api/cloud/virtualdatacenters/490/virtualappliances \ -H 'Accept:application/vnd.abiquo.virtualappliance+json; version=4.2' \ -H 'Content-Type:application/vnd.abiquo.virtualappliance+json; version=4.2' \ -d @requestpayload.xml \ -u user:password --verbose
Success status code: 201
Request payload:
{ "name":"vapp_vdc_m01j_001", "iconUrl":"https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png" }
Response payload:
{ "id":836, "error":0, "highDisponibility":0, "name":"vapp_vdc_m01j_001", "publicApp":0, "state":"NOT_DEPLOYED", "iconUrl":"https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png", "notAllocatedVirtualMachines":0, "onVirtualMachines":0, "offVirtualMachines":0, "pausedVirtualMachines":0, "allocatedVirtualMachines":0, "configuredVirtualMachines":0, "unknownVirtualMachines":0, "lockedVirtualMachines":0, "links":[ { "title":"vapp_vdc_m01j_001", "rel":"edit", "type":"application/vnd.abiquo.virtualappliance+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836" }, { "title":"vdc_m01j", "rel":"virtualdatacenter", "type":"application/vnd.abiquo.virtualdatacenter+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490" }, { "title":"AWS_enterprise_forBilling", "rel":"enterprise", "type":"application/vnd.abiquo.enterprise+json", "href":"https://example.com:443/api/admin/enterprises/65" }, { "title":"virtual machines", "rel":"virtualmachines", "type":"application/vnd.abiquo.virtualmachines+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines" }, { "title":"virtual appliances state", "rel":"state", "type":"application/vnd.abiquo.virtualappliancestate+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/state" }, { "title":"undeploy", "rel":"undeploy", "type":"application/vnd.abiquo.acceptedrequest+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/undeploy" }, { "title":"deploy", "rel":"deploy", "type":"application/vnd.abiquo.acceptedrequest+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/deploy" }, { "title":"price", "rel":"price", "type":"text/plain", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/price" }, { "title":"layers", "rel":"layers", "type":"application/vnd.abiquo.layers+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/layers" }, { "title":"alerts", "rel":"alerts", "type":"application/vnd.abiquo.alerts+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/alerts" }, { "title":"spec", "rel":"spec", "type":"application/vnd.abiquo.virtualappliancespec+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/action/spec" }, { "title":"tasks", "rel":"tasks", "type":"application/vnd.abiquo.tasks+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/tasks" }, { "title":"scalinggroups", "rel":"scalinggroups", "type":"application/vnd.abiquo.scalinggroups+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/scalinggroups" }, { "title":"metricsmetadata", "rel":"metricsmetadata", "type":"application/vnd.abiquo.metricsmetadata+json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/metrics" }, { "title":"collectd", "rel":"collectd", "type":"application/json", "href":"https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/metrics/collectd" } ] }
Next we can determine which templates are available to deploy in our virtual datacenter.
Get Templates available to the Virtual datacenter
Get all the templates from the repository that are compatible with your virtual datacenter. In this example we only show one virtual machine template.
API Roles required:
* This action requires the privilege VDC_ENUMERATE,VDC_MANAGE,VDC_MANAGE_VAP
cURL:
curl -X GET https://example.com/api/cloud/virtualdatacenters/490/action/templates -H 'Accept:application/vnd.abiquo.virtualmachinetemplates+json;version=4.2' \ -u user:password --verbose
Success status code: 200
Request payload:
--none--
Response payload:
{ "links": [ { "rel": "first", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates?limit=25&by=id&asc=true" }, { "rel": "last", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/action/templates?startwith=0&limit=25&by=id&asc=true" } ], "collection": [ { "id": "1168", "name": "amzn-ami-hvm-2015.03.0.x86_64-gp2", "description": "Amazon Linux AMI 2015.03.0 x86_64 HVM GP2", "osType": "OTHER_64", "cpuRequired": 2, "ramRequired": 60, "shared": false, "state": "DONE", "creationDate": "2018-02-13T11:41:04.000+0000", "creationUser": "137112412989", "chefEnabled": true, "iconUrl": "http://icons.abiquo.com/AWS-icon.png", "loginUser": "ec2-user", "variables": {}, "enableCpuHotAdd": false, "enableRamHotAdd": false, "enableDisksHotReconfigure": false, "enableNicsHotReconfigure": false, "enableRemoteAccessHotReconfigure": false, "enableOnlyHPRecommended": false, "generateGuestInitialPassword": false, "links": [ { "title": "AWS_enterprise_forBilling", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://example.com:443/api/admin/enterprises/65" }, { "title": "Others", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://example.com:443/api/config/categories/1" }, { "title": "amzn-ami-hvm-2015.03.0.x86_64-gp2", "rel": "edit", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/tasks" }, { "title": "repository", "rel": "datacenterrepository", "type": "application/vnd.abiquo.datacenterrepository+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2" }, { "title": "virtual machines", "rel": "virtualmachines", "type": "application/vnd.abiquo.virtualmachines+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/action/virtualmachines" }, { "title": "disks", "rel": "disks", "type": "application/vnd.abiquo.disks+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/disks" }, { "rel": "disk0", "type": "application/vnd.abiquo.disk+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168/disks/1371" }, { "title": "c3.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3084" }, { "title": "m3.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3106" }, { "title": "m4.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3111" }, { "title": "c3.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3085" }, { "title": "hs1.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3075" }, { "title": "t2.small", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3079" }, { "title": "c4.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3089" }, { "title": "m4.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3110" }, { "title": "c4.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3091" }, { "title": "r3.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3116" }, { "title": "r3.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3117" }, { "title": "g2.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3076" }, { "title": "r3.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3115" }, { "title": "m4.10xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3113" }, { "title": "cc2.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3073" }, { "title": "t2.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3081" }, { "title": "i2.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3096" }, { "title": "m3.medium", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3105" }, { "title": "m3.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3108" }, { "title": "i2.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3095" }, { "title": "i2.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3097" }, { "title": "c4.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3090" }, { "title": "m4.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3112" }, { "title": "r3.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3118" }, { "title": "i2.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3094" }, { "title": "d2.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3128" }, { "title": "c4.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3093" }, { "title": "m4.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3109" }, { "title": "d2.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3126" }, { "title": "hi1.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3074" }, { "title": "c3.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3088" }, { "title": "m3.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3107" }, { "title": "c3.2xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3086" }, { "title": "t2.medium", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3080" }, { "title": "cr1.8xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3129" }, { "title": "c3.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3087" }, { "title": "c4.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3092" }, { "title": "d2.4xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3127" }, { "title": "d2.xlarge", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3125" }, { "title": "r3.large", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3114" }, { "title": "t2.micro", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078" } ] } ], "totalSize": 1 }
Create the Virtual Machine
Now we will create the virtual machine. To do this, you will need:
- the virtual machines link from the virtual appliance you created
https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines
- the "edit" link to the compatible template (from the previous step). Note that the link here is in the template format. Change the rel entry from "edit" to "virtualmachinetemplate" to use it to create the virtual machine
{ "title": "amzn-ami-hvm-2015.03.0.x86_64-gp2", "rel": "edit", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168" },
- a "hardwareprofile" link for one of the hardware profiles allowed for the template
{ "title": "t2.micro", "rel": "hardwareprofile", "type": "application/vnd.abiquo.hardwareprofile+json", "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078" },
So the resulting virtual machine object will look like this:
{ "links": [ { "href": "https://example.com:443/api/admin/enterprises/65", "rel": "enterprise" }, { "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168" "rel": "virtualmachinetemplate" }, { "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078" "rel": "hardwareprofile", }, ], }
This is the simplest VM object required for creating a virtual machine in AWS.
So we will send a POST request with the VM object to the virtual machines link of the virtual appliance. Remember that until we deploy, the VM only exists in Abiquo – we haven't launched the VM in AWS yet.
cURL:
curl -X POST https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines \ -H 'Accept:application/vnd.abiquo.virtualmachine+json; version=4.2' \ -H 'Content-Type:application/vnd.abiquo.virtualmachine+json; version=4.2' \ -d @requestpayload.xml \ -u user:password --verbose
Success status code: 201
Request payload:
{ "links": [ { "href": "https://example.com:443/api/admin/enterprises/65", "rel": "enterprise" }, { "href": "https://example.com:443/api/admin/enterprises/65/datacenterrepositories/2/virtualmachinetemplates/1168", "rel": "virtualmachinetemplate" }, { "href": "https://example.com:443/api/cloud/locations/2/hardwareprofiles/3078", "rel": "hardwareprofile" } ] }
Response payload:
Deploy
Then we can either deploy the virtual machine or the virtual appliance using the links in the corresponding entity. For example, in the virtual machine above, the deploy link is:
{ "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/deploy" },
Deploy a Virtual Machine
API Roles required:
* This action requires the privilege VAPP_DEPLOY_UNDEPLOY
cURL:
curl -X POST https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/deploy \ -H 'Accept:application/vnd.abiquo.acceptedrequest+json;version=4.2' \ -u user:password --verbose
Success status code: 202
Request payload:
--none--
Response payload:
{ "message": "You can keep track of the progress in the link", "links": [ { "rel": "status", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/8ceb8256-6599-45f2-8989-e2d8e507c41a" } ] }
Undeploy a Virtual Machine
And undeploy:
* This action requires the privilege VAPP_DEPLOY_UNDEPLOY curl -X POST http://example.com:9000/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/action/undeploy \ -H 'Accept:application/vnd.abiquo.acceptedrequest+json; version=4.2' \ -H 'Content-Type:application/vnd.abiquo.virtualmachinetask+json; version=4.2' \ -d @requestpayload.json \ -u user:password --verbose
The request payload should be the standard virtual machine task entity
{ "forceVdcLimits": false, "forceEnterpriseSoftLimits": false, "forceUndeploy": false, "links": [] }
{ "message": "You can keep track of the progress in the link", "links": [ { "rel": "status", "href": "https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/cec70487-6d29-4fde-b6ef-e3488f5fe239" } ] }
Check Progress
We can query the progress using:
* This action requires the privilege VAPP_CUSTOMISE_SETTINGS
curl -X GET https://example.com:443/api/cloud/virtualdatacenters/490/virtualappliances/836/virtualmachines/6376/tasks/cec70487-6d29-4fde-b6ef-e3488f5fe239 \ -H 'Accept:application/vnd.abiquo.task+json; version=4.2' \ -u user:password --verbose
Here the undeploy task finished successfully