Create a first deployment: Just an Elasticsearch clusteredit

For our API exploration in some of the later examples, we need a basic deployment called My First Deployment that includes nothing but an Elasticsearch cluster.

The following API call includes all the necessary JSON you need to create this basic deployment:

curl -k -X POST -H "Authorization: ApiKey $ECE_API_KEY" https://$COORDINATOR_HOST:12443/api/v1/deployments -H 'content-type: application/json' -d '{
  "name": "My First Deployment",
  "resources":{
      "elasticsearch": [{
          "region": "ece-region",
          "ref_id": "main-elasticsearch",
          "plan": {
              "cluster_topology": [{
                  "node_type": {
                      "master": true,
                      "data": true,
                      "ingest": true
                  },
	              "instance_configuration_id": "data.default",
                  "zone_count": 1,
                  "size": {
                      "resource": "memory",
                      "value": 2048
                  }
              }],
              "elasticsearch": {
                  "version": "6.8.6"
              },
              "deployment_template": {
                  "id": "default"
              }
          }
      }]
  }
}'
resources
The set of resources in the deployment. As you can see in the JSON object, there is just one resource of type elasticsearch in the deployment.
region
The region will always be ece-region, since this is currently the only region available in an ECE environment.
ref_id
The unique ID for a resource in a deployment. This is used to connect other resources or to obtain information about the resource. You can set the ID to any value.
deployment_template
The template used to create the deployment. In this case, the default template is used, together with an instance configuration data.default for the Elasticsearch resource. Several other deployment templates and instance configurations are available.
version
The version of Elasticsearch to include in the deployment. If your installation of ECE does not include Elasticsearch 6.8.6, you can create a deployment for any version that you do have available. You can also add the missing versions to your installation by adding new Elastic Stack packs.

If you look closely, you can see that we use the same /api/v1/deployments endpoint as in our very first API example. The difference is that we now perform a POST request instead of a GET to create a deployment.

After the API call completes, Elastic Cloud Enterprise returns some information that you’re going to need later on, such as the deployment ID and the password for the elastic superuser. Write this information down and keep it somewhere safe.

{
  "id" : "$DEPLOYMENT_ID",
  "name" : "My First Deployment",
  "created" : true,
  "resources" : [
    {
      "ref_id": "main-elasticsearch",
      "id": "$ELASTICSEARCH_CLUSTER_ID",
      "kind": "elasticsearch",
      "region": "ece-region",
      "cloud_id": "My_First_Deployment:MTkyLjE...4JA==",
      "credentials": {
        "username": "elastic",
        "password": "$PASSWORD"
      }
    }
  ]
}