Deployment CRUD operationsedit

The following examples demonstrate Create, Read, Update and Delete operations on a deployments resource.

Listing your deploymentsedit

List the details about all of your Elasticsearch Service deployments.

curl \
-H "Authorization: ApiKey $EC_API_KEY" \
https://api.elastic-cloud.com/api/v1/deployments

Getting details about a particular deploymentedit

List the details about a particular deployment identified by id.

curl \
-H "Authorization: ApiKey $EC_API_KEY" \
"https://api.elastic-cloud.com/api/v1/deployments/$DEPLOYMENT_ID"

Using the API to create your first deploymentedit

The API request to create a new deployment is very descriptive, with many settings to tweak. An option we recommend is to configure your desired deployment in the Elastic Cloud UI and copy the JSON payload.

Create a deploymentedit

This example creates a new deployment with the following characteristics:

  • Version 7.6.2 of the Elastic Stack
  • Elasticsearch cluster in two zones with 4 GB of memory for each node
  • 1 GB single zone Kibana instance and a 512 MB APM instance
curl -XPOST \
-H 'Content-Type: application/json' \
-H "Authorization: ApiKey $EC_API_KEY" \
"https://api.elastic-cloud.com/api/v1/deployments" \
-d '
{
  "name": "my-first-api-deployment",
  "resources": {
    "elasticsearch": [
      {
        "region": "us-east-1", 
        "ref_id": "main-elasticsearch",
        "plan": {
          "cluster_topology": [
            {
              "node_type": {
                "data": true,
                "master": true,
                "ingest": true
              },
              "instance_configuration_id": "aws.data.highio.i3", 
              "zone_count": 2, 
              "size": {
                "resource": "memory",
                "value": 4096
              }
            }
          ],
          "elasticsearch": {
            "version": "7.6.2"
          },
          "deployment_template": {
            "id": "aws-io-optimized"
          }
        }
      }
    ],
    "kibana": [
      {
        "region": "us-east-1",
        "elasticsearch_cluster_ref_id": "main-elasticsearch",
        "ref_id": "main-kibana",
        "plan": {
          "cluster_topology": [
            {
              "instance_configuration_id": "aws.kibana.r4",
              "zone_count": 1, 
              "size": {
                "resource": "memory",
                "value": 1024
              }
            }
          ],
          "kibana": {
            "version": "7.6.2"
          }
        }
      }
    ],
    "apm": [
      {
        "region": "us-east-1",
        "elasticsearch_cluster_ref_id": "main-elasticsearch",
        "ref_id": "main-apm",
        "plan": {
          "apm": {
            "version": "7.6.2"
          },
          "cluster_topology": [
            {
              "instance_configuration_id": "aws.apm.r4",
              "zone_count": 1, 
              "size": {
                "value": 512, 
                "resource": "memory"
              }
            }
          ]
        }
      }
    ]
  }
}
'

Available Regions

Available instance configurations

Availability zones for the Elasticsearch cluster

Memory allocated for each Elasticsearch node

Available templates

Availability zones for Kibana

Memory allocated for Kibana

Availability zones for APM

Memory allocated for APM

Update a deploymentedit

Modify the Elasticsearch resource by increasing the amount of memory to 8 GB.

curl -XPUT \
-H 'Content-Type: application/json' \
-H "Authorization: ApiKey $EC_API_KEY" \
"https://api.elastic-cloud.com/api/v1/deployments/$DEPLOYMENT_ID" \
-d '
{
  "name": "my-first-api-deployment-with-new-name", 
  "prune_orphans": false,
  "resources": {
    "elasticsearch": [
      {
        "region": "us-east-1",
        "ref_id": "main-elasticsearch",
        "plan": {
          "cluster_topology": [
            {
              "instance_configuration_id": "aws.data.highio.i3",
              "node_type": {
                "data": true,
                "ingest": true,
                "master": true
              },
              "zone_count": 2,
              "size": {
                "resource": "memory",
                "value": 8192 
              }
            }
          ],
          "elasticsearch": {
            "version": "7.6.2"
          },
          "deployment_template": {
            "id": "aws-io-optimized"
          }
        }
      }
    ]
  }
}
'

Give the deployment a new name

Increase the amount of memory allocated for each Elasticsearch node to 8 GB

A 200 status code means that the configuration change was accepted.