# Looking for an example of template based cluster deployment via REST API

**URL:** <https://discuss.elastic.co/t/looking-for-an-example-of-template-based-cluster-deployment-via-rest-api/180708>\
**Category:** Elastic Cloud Enterprise (ECE)\
**Created:** [May 12, 2019, 5:06pm UTC](https://discuss.elastic.co/t/looking-for-an-example-of-template-based-cluster-deployment-via-rest-api/180708 "2019-05-12T17:06:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apaulsen](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@apaulsen](https://discuss.elastic.co/u/apaulsen)\
**Post date:** [May 12, 2019, 5:06pm UTC](https://discuss.elastic.co/t/looking-for-an-example-of-template-based-cluster-deployment-via-rest-api/180708/1 "2019-05-12T17:06:34Z")

</div>

Sorry - this is a double to my topic under category "Elasticsearch". Correctly it should be placed here - unter "Elastic Cloud Enterprise". i use an on prem installation of ECE.

I've created a custom Deployment template based on a custom Instance configuration.  
If I deploy a new cluster **via UI it works**.

**How can I create a new cluster based on my custom template vis REST API?**

**I can't find a working example for template based deployment in REST API Reference.**

Here is what I tried so far:

\*\*Variant 1: doesn't work \*\*

**(My hope was, that all cluster toplogy info would be taken from template.)**

curl -k -X POST -u admin ... clusters/elasticsearch -H 'content-type: application/json' -d '{  
"cluster\_name" : "MyCluster",  
"plan" : {  
"elasticsearch" : {  
"version" : "6.6.0"  
},  
"deployment\_template": {  
"id": "c7159de3c438493b9925474390a8a6a0"  
}  
}  
}'

**Variant 2: Creates a Cluster, but doesn't use my template**

curl -k -X POST -u admin ... clusters/elasticsearch -H 'content-type: application/json' -d '{  
"cluster\_name" : "MyCluster",  
"plan" : {  
"elasticsearch" : {  
"version" : "6.6.0"  
},  
"cluster\_topology" : [  
{  
"memory\_per\_node" : 2048,  
"node\_count\_per\_zone" : 1,  
"node\_type" : {  
"data" : true,  
"ingest" : true,  
"master" : true  
},  
"zone\_count" : 1  
}  
],  
"deployment\_template": {  
"id": "c7159de3c438493b9925474390a8a6a0"  
}  
}  
}'

The template id is correct.

TIA,  
Agnes

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [May 14, 2019, 1:39pm UTC](https://discuss.elastic.co/t/looking-for-an-example-of-template-based-cluster-deployment-via-rest-api/180708/2 "2019-05-14T13:39:48Z")

</div>

Currently the deployment template id is only used by the UI to display the right visual elements

So your variant 2 is correct (and the benefit of using the template is to ensure that you can subsequently edit it via the UI)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 28, 2019, 1:39pm UTC](https://discuss.elastic.co/t/looking-for-an-example-of-template-based-cluster-deployment-via-rest-api/180708/3 "2019-05-28T13:39:52Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
