Api create VM from Template

Api create VM from template

*Main steps:

- Preparation

- Create VM from template

*** Please note: This Api just create VM with default name (VM name of template), default network “VM Network”, default compute and storage.

1. Preparation

* Login IAM portal -> vCD portal: collect the information

- {{vcd_url}}

- {{vdc_uuid}}: Login vCD portal -> select vdc -> take a look and note vdc_uuid on the url

- {{network_uuid}}: On the vCD portal -> Networking -> Networks -> New

*** Note that the network name must be “VM Network”

+ Select the “VM Network” -> take a look and note the network uuid on the url

 

 

- {{vappTemplate_uuid}}: On the vCD portal -> Content Hub -> Catalogs ->HIGIO Shared Catalogs

-> vApp Templates -> select the template that you want to create VM -> take a look the vappTemplate_uuid on the url

 

 

-{{Bearer Token}}: Please follow “Api token login” document

 

2. Create VM from template

Postman:

POST https://{{vcd_url}}/api/vdc/{{vdc_uuid}}/action/instantiateVAppTemplate

Authorization: {{Bearer Token }}

Headers:

- 'Accept: */*;version=37.2

- ‘Content-type’: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml; charset=ISO-8859-1

Body: {{select raw, copy, paste and edit the code below}}

<?xml version="1.0" encoding="UTF-8"?>

<vcloud:InstantiateVAppTemplateParams

    xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

    xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"

    deploy="false"

    name="your vapp name"

    powerOn="false">

    <vcloud:Description>VApp Description</vcloud:Description>

    <vcloud:InstantiationParams>

        <vcloud:NetworkConfigSection>

            <ovf:Info>NetInfo</ovf:Info>

            <vcloud:NetworkConfig networkName="VM Network">

                <vcloud:Configuration>

                    <vcloud:ParentNetwork

                        href="https:// {{vcd_url}}/api/network/{{network_uuid}}"

                        name="VM Network"

                        type="application/vnd.vmware.vcloud.network+xml"/>

                    <vcloud:FenceMode>bridged</vcloud:FenceMode>

                </vcloud:Configuration>

            </vcloud:NetworkConfig>

        </vcloud:NetworkConfigSection>

    </vcloud:InstantiationParams>

    <vcloud:Source

        href="https://{{vcd_url}}/api/vAppTemplate/{{vappTemplate_uuid}}"

        name="HIGIO"

        type="application/vnd.vmware.vcloud.vAppTemplate+xml"/>

</vcloud:InstantiateVAppTemplateParams>

 

 

SEND request.

 

3. Verify

- On the vCD -> Data Center -> select your Virtual Data Center ->vApps -> check your vApp and VM