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

When you create a new deployment through the API, you have two options:

  1. Use default values. The simplest option is to create the deployment using a set of default values that are gathered automatically from a deployment template specified in the API request.
  2. Configure the deployment settings manually. With this option, the API request to create a new deployment is very descriptive, with many settings to tweak. If you use this option we recommend that you configure your desired deployment in the Elastic Cloud UI and copy the JSON payload.
Create a deployment using default valuesedit

This example requires minimal information in the API payload, and creates a deployment with default settings and a default name. You just need to specify one of the available deployment templates in your API request header and the deployment is created using default settings from that template.

curl -XPOST \
-H 'Content-Type: application/json' \
-H "Authorization: ApiKey $EC_API_KEY" \
"https://api.elastic-cloud.com/api/v1/deployments?template_id=aws-io-optimized" \
-d '
{
  "version": "7.11.0",
  "region": "gcp-europe-west1"
}
'

Optional: You can specify a version for the deployment. If this field is omitted a default version is used.

Required: One of the available regions must be provided in the request.

A resource field can be included in this request (check the following, manual example for the field details). When a resource is present, the content of the request is used instead of any default values provided by the the deployment template.

Create a deploymentedit

This example creates a new deployment named "my-first-api-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.