# How to create VM in opennebula 5.0 API using xml rpc?

**URL:** <https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738>\
**Category:** Integration Support\
**Created:** [February 8, 2017, 4:49am UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738 "2017-02-08T04:49:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![surya](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/surya/32/5097_2.png) [@surya](https://forum.opennebula.io/u/surya)\
**Post date:** [February 8, 2017, 4:49am UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738/1 "2017-02-08T04:49:48Z")

</div>

I need to create VM in opennebula 5.0.2 using xml rpc?what is the correct method one.vm.allocate or one.template.instantiate? what is the difference between two?

---

<div class="post-metadata">

**Author:** ![ruben](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ruben/32/19_2.png) [@ruben](https://forum.opennebula.io/u/ruben)\
**Post date:** [February 9, 2017, 2:55pm UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738/2 "2017-02-09T14:55:27Z")

</div>

These are two different way two create a VM:

- one.template.instantiate creates a new VM based on an existing template

- one.vm.allocate creates a new VM but you need to provide all the information of the VM

They resemble the CLI usage:

$ onetemplate instantiate 5 (creates a VM from template 5)

$ onevm create --name the\_vm --cpu 1 --memory 1024 --nic 2,3 --disk 1 --context yes …

---

<div class="post-metadata">

**Author:** ![Xgery](https://avatars.discourse-cdn.com/v4/letter/x/45deac/32.png) [@Xgery](https://forum.opennebula.io/u/Xgery)\
**Post date:** [May 28, 2020, 11:56am UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738/3 "2020-05-28T11:56:40Z")

</div>

Hi,

please could you write an example with “one.template.instantiate” ? I have tried this but everting is wrong. I have created the Template. I know how create VM via web, but I have no idea how to create VM via python (one.template.instantiate).

Thank you

XG

---

<div class="post-metadata">

**Author:** ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)\
**Post date:** [May 29, 2020, 9:14am UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738/4 "2020-05-29T09:14:09Z")

</div>

Hello @Xgery

You have an example [here](https://docs.opennebula.io/5.10/integration/system_interfaces/python.html) in the official documentation.

```auto
one.template.instantiate(0, "my_VM")

```

Best,  
Álex.

---

<div class="post-metadata">

**Author:** ![Xgery](https://avatars.discourse-cdn.com/v4/letter/x/45deac/32.png) [@Xgery](https://forum.opennebula.io/u/Xgery)\
**Post date:** [June 9, 2020, 7:15am UTC](https://forum.opennebula.io/t/how-to-create-vm-in-opennebula-5-0-api-using-xml-rpc/3738/5 "2020-06-09T07:15:54Z")

</div>

Hello @ahuertas

Thank you…
