# Working example for template based cluster deployment via REST API?

**URL:** <https://discuss.elastic.co/t/working-example-for-template-based-cluster-deployment-via-rest-api/180674>\
**Category:** Elasticsearch\
**Created:** [May 11, 2019, 10:04pm UTC](https://discuss.elastic.co/t/working-example-for-template-based-cluster-deployment-via-rest-api/180674 "2019-05-11T22:04:01Z")\
**Posts on this page:** 2\
**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 11, 2019, 10:04pm UTC](https://discuss.elastic.co/t/working-example-for-template-based-cluster-deployment-via-rest-api/180674/1 "2019-05-11T22:04:01Z")

</div>

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 at all)**

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"  
}  
}  
}'

TIA,  
Agnes

---

<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:** [June 8, 2019, 10:04pm UTC](https://discuss.elastic.co/t/working-example-for-template-based-cluster-deployment-via-rest-api/180674/2 "2019-06-08T22:04:10Z")

</div>

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