Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install provisioning@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin provisioning v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install provisioning

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/cloud-provisioning/

Extract the ZIP to .github/skills/ in your repo. The folder name must match cloud-provisioning for Copilot to auto-discover it.

Skill Files (5)

SKILL.md 21.2 KB
---
name: cloud-provisioning
description: >
  Provision and operate Elastic Cloud infrastructure: create, connect to, update,
  and delete Serverless projects (Elasticsearch, Observability, Security); manage
  traffic filters (IP and AWS PrivateLink network security); and manage the lifecycle
  of Elastic Cloud Hosted deployments. Use when creating or performing day-2 operations
  on serverless projects or hosted deployments, or restricting their network access.
compatibility: >
  Requires the `elastic` CLI (>= 0.2) with `cloud serverless` and `cloud hosted` support
  and network access to the Elastic Cloud API (api.elastic-cloud.com). Serverless
  operations apply to Elastic Cloud Serverless; deployment operations apply to Elastic
  Cloud Hosted. Depends on a configured Cloud context (see cloud-onboarding).
metadata:
  author: elastic
  version: 0.3.0
  universal: true
---

# Cloud Provisioning

Provision and run Elastic Cloud infrastructure through the Cloud API: **Serverless projects** (create and day-2
operations), **traffic filters** (network security for those projects), and **Elastic Cloud Hosted deployments**. For
configuring Cloud authentication and managing organization access, use the **cloud-onboarding** skill.

<!-- begin-partial: cloud-preamble -->

## Environment Configuration

This skill operates the Elastic Cloud control plane through the `elastic` CLI. If the
[`elastic` CLI](https://github.com/elastic/cli#configuration) is not installed, tell the user what it is needed for. Do
not guess credentials, bypass the CLI to call the HTTP API directly, or attempt other workarounds.

Control-plane operations authenticate against the Elastic Cloud API (organization scope), not a single stack deployment.
The `elastic` CLI reads this from its active context, which stores an Elastic Cloud API key in the OS keychain. If a
control-plane call fails with an authentication error, the context is missing or lacks a Cloud API key — instruct the
user to add one, and **never** ask the user to paste an API key into the chat:

> "Configure an Elastic Cloud context for the `elastic` CLI, then re-run. Generate an Organization-level key at
> [Elastic Cloud API keys](https://cloud.elastic.co/account/keys) and register it without echoing the secret in chat."

This skill references control-plane operations in HTTP-shorthand form with the `cloud:` prefix (e.g.,
`GET cloud:/api/v1/organizations`, `POST cloud:/api/v1/serverless/projects/elasticsearch`). The
[Operations](#operations) table at the end of this document maps each shorthand to the equivalent `elastic cloud`
command — always use the CLI rather than calling the HTTP API directly. Discover the organization ID from
`GET cloud:/api/v1/organizations`; do not ask the user for it.

<!-- end-partial: cloud-preamble -->

## Critical principles

- **Never display secrets in chat.** Do not echo, log, or repeat passwords or API keys in conversation or agent
  thinking. Persist credentials into a CLI context (OS keychain) and direct the user there.
- **Confirm before creating or destroying.** A project's or deployment's region is permanent; deletion is irreversible.
  Present the configuration and get explicit confirmation before creating, deleting, or resetting credentials.
- **Admin credentials are bootstrap-only.** The `admin` password returned on creation or reset exists solely to create a
  scoped API key. Never use admin credentials for ongoing Elasticsearch operations — mint a scoped key first.
- **Wait for readiness.** A new project or deployment starts `initializing`; wait until `initialized` before using it.
- **Two kinds of credentials.** The **Cloud context** (Cloud API key) authorizes control-plane operations here. A
  project's or deployment's **Elasticsearch API key** authorizes data-plane operations against its Elasticsearch
  endpoint — do not confuse the two. See [references/credentials-and-context.md](references/credentials-and-context.md).

---

## Serverless projects

### Project types

| Type            | Description                               | Included services                |
| --------------- | ----------------------------------------- | -------------------------------- |
| `elasticsearch` | Search, analytics, and vector workloads   | Elasticsearch, Kibana            |
| `observability` | Logs, metrics, traces, and APM            | Elasticsearch, Kibana, APM, OTLP |
| `security`      | SIEM, endpoint protection, cloud security | Elasticsearch, Kibana, OTLP      |

Map the user's request to the correct type; never silently default — infer from context and confirm, or ask when
ambiguous. "search"/"elasticsearch"/vector search → `elasticsearch`; "o11y"/logs/metrics/traces/APM → `observability`;
"SIEM"/detections/endpoint → `security`.

**Tiers and optimization.** Elasticsearch: set `optimized_for` to `general_purpose` (default) unless the user explicitly
requests `vector`. Observability: set `product_tier` to `complete` (default) or `logs_essentials`. Security: set
`product_types` tiers to `complete` (default) or `essentials` per product line (`security`, `cloud`, `endpoint`). See
[references/api-reference.md](references/api-reference.md) for the full request-body schema of each type.

### Process: create a serverless project

1. **Confirm the project type.** Infer it from the conversation and propose it, or ask the user to choose. Do not
   proceed on an assumed type.
2. **Confirm the configuration.** Present a summary — name (required; ask if missing), region (default
   `gcp-us-central1`), and the tier/optimization for the type — and get explicit confirmation. If the region is
   uncertain, list options with `GET cloud:/api/v1/serverless/regions` first; only regions with
   `project_creation_enabled: true` accept new projects. Region is permanent.
3. **Create the project.** Call `POST cloud:/api/v1/serverless/projects/{type}` with the confirmed body. Wait for the
   `initialized` phase and persist the returned credentials into a named CLI context (the password goes to the OS
   keychain, never to stdout or chat).
4. **Verify readiness.** If creation did not block until ready, poll
   `GET cloud:/api/v1/serverless/projects/{type}/{id}/status` until `phase` is `initialized`. The Elasticsearch and
   Kibana endpoints in the creation response are safe to share; the password is not.
5. **Bootstrap a scoped API key.** Using the project context, create a scoped Elasticsearch API key with only the
   privileges the user needs via `POST /_security/api_key` (the project's Elasticsearch endpoint), then rely on that key
   for all data-plane work. If the **elasticsearch-authn** skill is available, use it for full key lifecycle handling.

### Workflow: connect to an existing project

Use this when the user asks to query or manage a project not created in the current session. It applies to **Elastic
Cloud Serverless projects only** — if the cluster is self-managed or Elastic Cloud Hosted, use the Hosted deployment
workflow or skip. If unsure, ask: "Is your Elasticsearch instance an Elastic Cloud Serverless project?"

1. **Resolve the project.** Infer the type and list projects with `GET cloud:/api/v1/serverless/projects/{type}`. Match
   the user's reference (name or alias). If multiple or none match, present candidates and ask.
2. **Load endpoints and credentials.** Fetch the project with `GET cloud:/api/v1/serverless/projects/{type}/{id}` to get
   its Elasticsearch and Kibana endpoints, and select or create a CLI context bound to it.
3. **Acquire Elasticsearch credentials.** Verify any existing project API key with `GET /_security/_authenticate`
   (expect `"authentication_type": "api_key"`). If none works, confirm with the user, reset the admin bootstrap
   credentials with `POST cloud:/api/v1/serverless/projects/{type}/{id}/_reset-credentials`, use the admin password once
   to create a scoped key via `POST /_security/api_key`, persist it to the context, re-verify, and drop the admin
   credentials.

### Day-2: list, get, update, delete, resume

- **List** projects of a type: `GET cloud:/api/v1/serverless/projects/{type}`.
- **Get** one project: `GET cloud:/api/v1/serverless/projects/{type}/{id}`.
- **Update** (PATCH semantics — only supplied fields change): `PATCH cloud:/api/v1/serverless/projects/{type}/{id}`.
- **Reset credentials** (confirm first): `POST cloud:/api/v1/serverless/projects/{type}/{id}/_reset-credentials`.
- **Delete** (confirm first — permanent): `DELETE cloud:/api/v1/serverless/projects/{type}/{id}`.
- **Resume** a suspended project, then poll status until `initialized`:
  `POST cloud:/api/v1/serverless/projects/{type}/{id}/_resume`.

**Update fields and their risks.** Supported PATCH fields: `name`, `alias`, `metadata.tags`, `traffic_filters`, and —
for Elasticsearch — `search_lake.search_power` (28–3000) and `search_lake.boost_window` (1–180 days); for Security —
data-retention limits.

- **Alias changes rewrite every endpoint URL**, breaking existing clients. Warn before changing it.
- **Tags replace the whole tag set.** Read current tags with a `GET` first and include any the user wants to keep.
- **`search_power` drives cost.** Higher values increase VCU consumption. Warn and confirm before raising it (presets:
  28 on-demand, 100 performant, 250 high availability).
- **Reducing max retention permanently deletes data** older than the new limit. Warn and confirm before lowering it.

---

## Traffic filters (network security)

Traffic filters restrict network access to Serverless projects. The Elastic Cloud UI calls this **network security**;
the Cloud API uses **traffic filters** (`traffic-filters` in paths, `traffic_filters` in project JSON). The two types
are **IP filters** (type `ip`, allowlist IPs/CIDRs) and **VPC filters** (type `vpce`, AWS PrivateLink endpoint IDs).

> Private connectivity in AWS is accepted by default. A VPC filter is only needed to **restrict** traffic to specific
> endpoint IDs. If you only need private connectivity (not filtering), create the VPC endpoint and DNS record in AWS —
> no filter is required. Use `GET cloud:/api/v1/serverless/traffic-filters/metadata` to look up the PrivateLink service
> name for a region before creating the endpoint in AWS.

### Process: create and attach a filter

1. **Identify components.** Filter type (IP vs VPC), target region, source rules (IPs/CIDRs or VPC endpoint IDs), and
   which projects the filter should apply to.
2. **Check existing state.** List current filters with `GET cloud:/api/v1/serverless/traffic-filters` (optionally scoped
   by region). If a filter already covers the same sources **for the same purpose**, reuse it — filters are
   region-scoped and can attach to many projects.
3. **Create the filter.** Call `POST cloud:/api/v1/serverless/traffic-filters` with the `type`, `region`, and `rules`.
   The response contains the generated filter `id`.
4. **Associate with projects.** Filter-to-project association is done through the project PATCH endpoint
   (`PATCH cloud:/api/v1/serverless/projects/{type}/{id}` with a `traffic_filters` array). Provide the **complete** list
   of filter IDs; any ID omitted is disassociated.
5. **Verify.** List filters again or `GET` the project to confirm the change took effect.

**Filter guidance:** filters are region-scoped (a filter can only attach to projects in its region). Updating rules
replaces the entire rule set — include all existing rules plus the new one. A filter cannot be deleted while still
associated with a project — disassociate first, then `DELETE cloud:/api/v1/serverless/traffic-filters/{id}`.
`include_by_default` auto-attaches a filter to all new projects in the region — use with caution. See
[references/traffic-filters.md](references/traffic-filters.md) for the full schemas.

---

## Hosted deployments

Elastic Cloud Hosted deployments are full stack deployments (Elasticsearch, Kibana, and optional APM/Integrations
Server/Enterprise Search) sized from a deployment template, distinct from Serverless projects. Manage their lifecycle
through the Cloud API's deployment endpoints.

### Process: create a hosted deployment

1. **Choose a region and template.** List deployment templates with `GET cloud:/api/v1/deployments/templates` for the
   target region and confirm the template and stack version with the user. Region is permanent.
2. **Confirm the configuration** (name, region, template, version, sizing) and get explicit confirmation before
   creating.
3. **Create the deployment.** Call `POST cloud:/api/v1/deployments` with the resource definition (or a `template_id`).
   The response returns the deployment ID and a one-time `elastic` user password and endpoints — persist the credentials
   into a CLI context (keychain), never to chat.
4. **Verify readiness and bootstrap a scoped key.** Poll `GET cloud:/api/v1/deployments/{id}` until healthy, then mint a
   scoped Elasticsearch API key via `POST /_security/api_key` and stop using the bootstrap `elastic` password. See
   [references/hosted-deployments.md](references/hosted-deployments.md) for the create body and template schema.

### Day-2: get, update, shut down, restore

- **List** deployments: `GET cloud:/api/v1/deployments`.
- **Get** one deployment: `GET cloud:/api/v1/deployments/{id}`.
- **Update** (resize, upgrade version, change resources): `PUT cloud:/api/v1/deployments/{id}`.
- **Shut down** (confirm first — stops the deployment): `POST cloud:/api/v1/deployments/{id}/_shutdown`.
- **Restore** a shut-down deployment: `POST cloud:/api/v1/deployments/{id}/_restore`.

Hosted deployments use their own **traffic-filter rulesets**, managed separately from the Serverless traffic filters
above — do not mix the two. See [references/hosted-deployments.md](references/hosted-deployments.md).

---

## Examples

**"Create a search project called acme-search"** — confirm type `elasticsearch`, present the summary (name
`acme-search`, region `gcp-us-central1`, `optimized_for general_purpose`), and on confirmation call
`POST cloud:/api/v1/serverless/projects/elasticsearch`, wait for `initialized`, persist credentials, then create a
scoped API key with `POST /_security/api_key`.

**"List my security projects"** — call `GET cloud:/api/v1/serverless/projects/security` and present the names and IDs;
treat it as a read-only day-2 request.

**"Connect to my search project prod-search"** — list Elasticsearch projects, match `prod-search`, `GET` it for
endpoints, then verify or mint a scoped Elasticsearch API key before any data-plane work.

**"Bump search power to 500 on my search project"** — warn about the cost increase, confirm, then
`PATCH cloud:/api/v1/serverless/projects/elasticsearch/{id}` with `search_lake.search_power = 500`.

**"Only allow our office network 203.0.113.0/24 to projects in us-east-1"** — list existing filters for `us-east-1`,
create an `ip` filter with `POST cloud:/api/v1/serverless/traffic-filters` (rule source `203.0.113.0/24`), then attach
the filter ID to the target projects via `PATCH cloud:/api/v1/serverless/projects/{type}/{id}`.

**"Spin up a hosted deployment in us-east-1"** — list templates with `GET cloud:/api/v1/deployments/templates`, confirm
the template and stack version, then `POST cloud:/api/v1/deployments`, wait until healthy, and mint a scoped API key.

## Guidelines

- Validate the Cloud context first (see [Environment Configuration](#environment-configuration)); use
  **cloud-onboarding** to configure it when validation fails.
- Never display passwords or API keys in chat — persist them to a CLI context (OS keychain), and mint a scoped API key
  instead of relying on bootstrap admin credentials.
- Never silently default a project type; infer and confirm. Default to `general_purpose` optimization and the `complete`
  tier; only change on explicit request.
- Region cannot be changed after creation, and deletion/shutdown is permanent — confirm before proceeding.
- Traffic filters are region-scoped; updating rules replaces the whole set; disassociate a filter from all projects
  before deleting it.
- Keep Serverless traffic filters and Hosted deployment traffic-filter rulesets separate — they are different APIs.
- For granting user access and Cloud API keys, see **cloud-onboarding**; for Elasticsearch data-plane key lifecycle, see
  **elasticsearch-authn**.

## Operations

| HTTP API (shorthand)                                                           | `elastic` CLI command                                                                               |
| ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| `GET cloud:/api/v1/serverless/regions`                                         | `elastic cloud serverless regions list-regions`                                                     |
| `POST cloud:/api/v1/serverless/projects/elasticsearch`                         | `elastic cloud serverless projects search create --input-file <json> --wait --save-as <ctx>`        |
| `POST cloud:/api/v1/serverless/projects/observability`                         | `elastic cloud serverless projects observability create --input-file <json> --wait --save-as <ctx>` |
| `POST cloud:/api/v1/serverless/projects/security`                              | `elastic cloud serverless projects security create --input-file <json> --wait --save-as <ctx>`      |
| `GET cloud:/api/v1/serverless/projects/elasticsearch`                          | `elastic cloud serverless projects search list`                                                     |
| `GET cloud:/api/v1/serverless/projects/elasticsearch/{id}`                     | `elastic cloud serverless projects search get --id <id>`                                            |
| `GET cloud:/api/v1/serverless/projects/elasticsearch/{id}/status`              | `elastic cloud serverless projects search get-status --id <id>`                                     |
| `PATCH cloud:/api/v1/serverless/projects/elasticsearch/{id}`                   | `elastic cloud serverless projects search patch --id <id> --input-file <json>`                      |
| `DELETE cloud:/api/v1/serverless/projects/elasticsearch/{id}`                  | `elastic cloud serverless projects search delete --id <id>`                                         |
| `POST cloud:/api/v1/serverless/projects/elasticsearch/{id}/_reset-credentials` | `elastic cloud serverless projects search reset-credentials --id <id> --save-as <ctx>`              |
| `POST cloud:/api/v1/serverless/projects/elasticsearch/{id}/_resume`            | `elastic cloud serverless projects search resume --id <id>`                                         |
| `GET cloud:/api/v1/serverless/traffic-filters`                                 | `elastic cloud serverless traffic-filters list-traffic-filters --region <region>`                   |
| `POST cloud:/api/v1/serverless/traffic-filters`                                | `elastic cloud serverless traffic-filters create-traffic-filter --input-file <json>`                |
| `GET cloud:/api/v1/serverless/traffic-filters/{id}`                            | `elastic cloud serverless traffic-filters get-traffic-filter --id <id>`                             |
| `PATCH cloud:/api/v1/serverless/traffic-filters/{id}`                          | `elastic cloud serverless traffic-filters patch-traffic-filter --id <id> --input-file <json>`       |
| `DELETE cloud:/api/v1/serverless/traffic-filters/{id}`                         | `elastic cloud serverless traffic-filters delete-traffic-filter --id <id>`                          |
| `GET cloud:/api/v1/serverless/traffic-filters/metadata`                        | `elastic cloud serverless traffic-filters get-traffic-filter-metadata --region <region>`            |
| `GET cloud:/api/v1/deployments/templates`                                      | `elastic cloud hosted deployment-templates get-deployment-templates-v2`                             |
| `GET cloud:/api/v1/deployments`                                                | `elastic cloud hosted deployments list-deployments`                                                 |
| `POST cloud:/api/v1/deployments`                                               | `elastic cloud hosted deployments create-deployment --input-file <json>`                            |
| `GET cloud:/api/v1/deployments/{id}`                                           | `elastic cloud hosted deployments get-deployment --deployment-id <id>`                              |
| `PUT cloud:/api/v1/deployments/{id}`                                           | `elastic cloud hosted deployments update-deployment --deployment-id <id> --input-file <json>`       |
| `POST cloud:/api/v1/deployments/{id}/_shutdown`                                | `elastic cloud hosted deployments shutdown-deployment --deployment-id <id>`                         |
| `POST cloud:/api/v1/deployments/{id}/_restore`                                 | `elastic cloud hosted deployments restore-deployment --deployment-id <id>`                          |
| `GET /_security/_authenticate`                                                 | `elastic es security authenticate`                                                                  |
| `POST /_security/api_key`                                                      | `elastic es security create-api-key --input-file <json>`                                            |

Use the matching `projects observability …` / `projects security …` commands for observability and security project
types.
references/
api-reference.md 9.4 KB
# Elastic Cloud Serverless API Reference

Reference for the Elastic Cloud Serverless project management API. Base URL: `https://api.elastic-cloud.com`.

All requests require an API key in the `Authorization` header:

```text
Authorization: ApiKey <your-api-key>
```

## Endpoints

### Projects

| Method   | Path                                                         | Description              |
| -------- | ------------------------------------------------------------ | ------------------------ |
| `POST`   | `/api/v1/serverless/projects/{type}`                         | Create a project         |
| `GET`    | `/api/v1/serverless/projects/{type}`                         | List projects            |
| `GET`    | `/api/v1/serverless/projects/{type}/{id}`                    | Get project details      |
| `PATCH`  | `/api/v1/serverless/projects/{type}/{id}`                    | Update a project         |
| `DELETE` | `/api/v1/serverless/projects/{type}/{id}`                    | Delete a project         |
| `GET`    | `/api/v1/serverless/projects/{type}/{id}/status`             | Get project status       |
| `POST`   | `/api/v1/serverless/projects/{type}/{id}/_reset-credentials` | Reset credentials        |
| `POST`   | `/api/v1/serverless/projects/{type}/{id}/_resume`            | Resume suspended project |
| `GET`    | `/api/v1/serverless/projects/{type}/{id}/roles`              | Get project roles        |

Where `{type}` is one of: `elasticsearch`, `observability`, `security`.

### Regions

| Method | Path                              | Description        |
| ------ | --------------------------------- | ------------------ |
| `GET`  | `/api/v1/serverless/regions`      | List all regions   |
| `GET`  | `/api/v1/serverless/regions/{id}` | Get region details |

### Traffic Filters

| Method   | Path                                      | Description             |
| -------- | ----------------------------------------- | ----------------------- |
| `POST`   | `/api/v1/serverless/traffic-filters`      | Create a traffic filter |
| `GET`    | `/api/v1/serverless/traffic-filters`      | List traffic filters    |
| `GET`    | `/api/v1/serverless/traffic-filters/{id}` | Get a traffic filter    |
| `PATCH`  | `/api/v1/serverless/traffic-filters/{id}` | Update a traffic filter |
| `DELETE` | `/api/v1/serverless/traffic-filters/{id}` | Delete a traffic filter |

## Create project request bodies

### Elasticsearch

```json
{
  "name": "my-es-project",
  "region_id": "gcp-us-central1",
  "optimized_for": "general_purpose",
  "search_lake": {
    "search_power": 100,
    "boost_window": 30
  }
}
```

| Field           | Type   | Required | Description                                          |
| --------------- | ------ | -------- | ---------------------------------------------------- |
| `name`          | string | Yes      | Project name (1–255 chars)                           |
| `region_id`     | string | Yes      | Region ID (for example, `gcp-us-central1`)           |
| `alias`         | string | No       | Custom domain label (RFC-1035, max 50 chars)         |
| `optimized_for` | string | No       | `general_purpose` (default) or `vector`              |
| `search_lake`   | object | No       | Search power (28–3000) and boost window (1–180 days) |

`optimized_for` options:

- `general_purpose` — suitable for full-text search, sparse vectors, compressed dense vectors. Default when creating
  from the UI.
- `vector` — for uncompressed dense vectors with high dimensionality. Impacts VCU consumption.

### Observability

```json
{
  "name": "my-obs-project",
  "region_id": "gcp-us-central1",
  "product_tier": "complete"
}
```

| Field          | Type   | Required | Description                               |
| -------------- | ------ | -------- | ----------------------------------------- |
| `name`         | string | Yes      | Project name                              |
| `region_id`    | string | Yes      | Region ID                                 |
| `alias`        | string | No       | Custom domain label                       |
| `product_tier` | string | No       | `complete` (default) or `logs_essentials` |

### Security

```json
{
  "name": "my-sec-project",
  "region_id": "gcp-us-central1",
  "product_types": [
    { "product_line": "security", "product_tier": "complete" },
    { "product_line": "cloud", "product_tier": "complete" },
    { "product_line": "endpoint", "product_tier": "complete" }
  ]
}
```

| Field                    | Type   | Required | Description                                         |
| ------------------------ | ------ | -------- | --------------------------------------------------- |
| `name`                   | string | Yes      | Project name                                        |
| `region_id`              | string | Yes      | Region ID                                           |
| `alias`                  | string | No       | Custom domain label                                 |
| `admin_features_package` | string | No       | `standard` or `enterprise` (BYOK, BYOIDP, CCS, CCR) |
| `product_types`          | array  | No       | Array of product line/tier pairs                    |
| `search_lake`            | object | No       | Data retention config                               |

Product lines: `security`, `cloud`, `endpoint`. Product tiers: `complete`, `essentials`.

## Creation response

All project types return the same response structure:

```json
{
  "id": "abc123def456abc123def456abc12345",
  "name": "my-project",
  "alias": "my-project-bdc0f7",
  "region_id": "gcp-us-central1",
  "cloud_id": "bXktcHJvamVjdDo...",
  "type": "elasticsearch",
  "metadata": {
    "created_at": "2025-01-15T10:30:00Z",
    "created_by": "1014289666002276",
    "organization_id": "198583657190"
  },
  "endpoints": {
    "elasticsearch": "https://my-project-bdc0f7.es.us-east-1.aws.elastic.cloud",
    "kibana": "https://my-project-bdc0f7.kb.us-east-1.aws.elastic.cloud"
  },
  "credentials": {
    "username": "admin",
    "password": "REDACTED"
  }
}
```

Observability projects also include `apm` and `ingest` endpoints. Security projects include an `ingest` endpoint.

The `credentials` block is only returned on creation and reset. Save the password immediately.

## Project status

```json
{
  "phase": "initializing"
}
```

Phases:

| Phase          | Description                               |
| -------------- | ----------------------------------------- |
| `initializing` | Project is being created, not ready yet   |
| `initialized`  | Project is ready for use                  |
| `suspending`   | Project is being suspended                |
| `suspended`    | Project is suspended (trial expired)      |
| `deleting`     | Project is being deleted                  |
| `deleted`      | Project has been deleted (terminal state) |

## Regions

Common regions for serverless projects:

### AWS

| Region ID            | Location    |
| -------------------- | ----------- |
| `aws-us-east-1`      | N. Virginia |
| `aws-us-east-2`      | Ohio        |
| `aws-us-west-2`      | Oregon      |
| `aws-eu-west-1`      | Ireland     |
| `aws-eu-central-1`   | Frankfurt   |
| `aws-ap-southeast-1` | Singapore   |
| `aws-eu-west-2`      | London      |
| `aws-ap-northeast-1` | Tokyo       |
| `aws-ap-southeast-2` | Sydney      |
| `aws-ca-central-1`   | Canada      |

### GCP

| Region ID               | Location       |
| ----------------------- | -------------- |
| `gcp-us-central1`       | Iowa           |
| `gcp-europe-west1`      | Belgium        |
| `gcp-us-west1`          | Oregon         |
| `gcp-europe-west2`      | London         |
| `gcp-asia-northeast1`   | Tokyo          |
| `gcp-asia-south1`       | Mumbai         |
| `gcp-us-east4`          | N. Virginia    |
| `gcp-us-east1`          | South Carolina |
| `gcp-asia-southeast1`   | Singapore      |
| `gcp-europe-west3`      | Frankfurt      |
| `gcp-europe-west4`      | Netherlands    |
| `gcp-europe-southwest1` | Madrid         |

### Azure

| Region ID                  | Location        |
| -------------------------- | --------------- |
| `azure-eastus`             | Virginia        |
| `azure-australiaeast`      | New South Wales |
| `azure-northeurope`        | Ireland         |
| `azure-germanywestcentral` | Frankfurt       |
| `azure-southeastasia`      | Singapore       |
| `azure-spaincentral`       | Madrid          |
| `azure-uaenorth`           | Dubai           |
| `azure-swedencentral`      | Stockholm       |
| `azure-westus2`            | Washington      |
| `azure-eastus2`            | Virginia        |
| `azure-brazilsouth`        | Sao Paulo       |
| `azure-centralus`          | Iowa            |

Use `GET /api/v1/serverless/regions` for the complete, up-to-date list. Only regions with
`project_creation_enabled: true` accept new projects.

## Error responses

All errors follow this format:

```json
{
  "errors": [
    {
      "message": "Explanatory error message",
      "code": "code.error"
    }
  ]
}
```

| HTTP Code | Meaning              |
| --------- | -------------------- |
| 400       | Bad request          |
| 401       | Invalid API key      |
| 404       | Project not found    |
| 409       | Conflict             |
| 412       | Precondition failed  |
| 422       | Unprocessable entity |

## Traffic filters

Traffic filters restrict network access to projects. Attach them during creation or using PATCH:

```json
{
  "traffic_filters": [{ "id": "traffic-filter-id" }]
}
```

Filter types: `ip` (IP/CIDR rules) or `vpce` (VPC endpoint IDs).
credentials-and-context.md 3.0 KB
# Serverless Projects: Credentials and CLI Context

Day-2 operations run through the `elastic` CLI, which keeps connection details in **contexts** in its config file
(`~/.elasticrc.yml`) and stores secrets in the OS keychain. This replaces the older `.elastic-credentials` file the
script-based skill used.

## How project credentials flow

1. **Create or reset** returns the project's endpoints and a one-time `admin` password. Persisting them with a named
   context (`--save-as <name>`) writes the endpoints to the config file and the secret to the keychain — nothing is
   printed to stdout or chat. A standalone `--credentials-file <path>` YAML fragment (mode `0600`) is an alternative
   when a keychain is unavailable.
2. **Admin is bootstrap-only.** The `admin` user has full privileges and cannot be modified in serverless. Use its
   password exactly once to mint a scoped Elasticsearch API key (`POST /_security/api_key`), then rely on that key.
3. **Select the project** for data-plane work by activating its context (or passing `--use-context <name>`), so bare
   Elasticsearch shorthand (`GET /_security/_authenticate`, `POST /_security/api_key`) targets the right endpoint.

## Serverless projects API endpoints

| Method   | Path                                                         | Description              |
| -------- | ------------------------------------------------------------ | ------------------------ |
| `GET`    | `/api/v1/serverless/projects/{type}`                         | List projects            |
| `GET`    | `/api/v1/serverless/projects/{type}/{id}`                    | Get project details      |
| `PATCH`  | `/api/v1/serverless/projects/{type}/{id}`                    | Update a project         |
| `DELETE` | `/api/v1/serverless/projects/{type}/{id}`                    | Delete a project         |
| `GET`    | `/api/v1/serverless/projects/{type}/{id}/status`             | Get project status       |
| `POST`   | `/api/v1/serverless/projects/{type}/{id}/_reset-credentials` | Reset credentials        |
| `POST`   | `/api/v1/serverless/projects/{type}/{id}/_resume`            | Resume suspended project |

Where `{type}` is one of `elasticsearch`, `observability`, or `security`.

## Project phases

| Phase          | Meaning                                |
| -------------- | -------------------------------------- |
| `initializing` | Being created; not ready yet           |
| `initialized`  | Ready for use                          |
| `suspending`   | Being suspended                        |
| `suspended`    | Suspended (for example, trial expired) |
| `deleting`     | Being deleted                          |
| `deleted`      | Deleted (terminal state)               |

## Security guidance

- Never echo, log, or repeat passwords or API keys in chat or agent thinking.
- Prefer a scoped Elasticsearch API key over admin credentials for all data-plane work.
- For production or shared environments, back the CLI secret store with a centralized secrets manager rather than local
  files.
hosted-deployments.md 6.0 KB
# Elastic Cloud Hosted Deployments — API Reference

Reference for provisioning and operating Elastic Cloud Hosted deployments through the Cloud API. Base URL:
`https://api.elastic-cloud.com`. All requests require an Elastic Cloud API key in the `Authorization: ApiKey <key>`
header, supplied by the `elastic` CLI Cloud context.

Hosted deployments are full stack deployments (Elasticsearch, Kibana, and optionally APM/Integrations Server and
Enterprise Search) sized from a **deployment template**, distinct from Serverless projects.

## Endpoints

| Method | Path                                 | Description                      |
| ------ | ------------------------------------ | -------------------------------- |
| `GET`  | `/api/v1/deployments`                | List deployments                 |
| `POST` | `/api/v1/deployments`                | Create a deployment              |
| `GET`  | `/api/v1/deployments/{id}`           | Get a deployment                 |
| `PUT`  | `/api/v1/deployments/{id}`           | Update (resize/upgrade/reconfig) |
| `POST` | `/api/v1/deployments/{id}/_shutdown` | Shut down a deployment           |
| `POST` | `/api/v1/deployments/{id}/_restore`  | Restore a shut-down deployment   |
| `GET`  | `/api/v1/deployments/templates`      | List deployment templates        |
| `GET`  | `/api/v1/deployments/templates/{id}` | Get a deployment template        |

## Deployment templates

A template pre-fills the `resources` block for a region and use case (for example, general purpose, vector search,
CPU-optimized). List templates for the target region first, then either reference the template by `id` on creation or
copy its `deployment_template` resource block and adjust sizing.

```text
GET /api/v1/deployments/templates?region=us-east-1
```

Each template exposes an `id`, `name`, `description`, and a `deployment_template` resource definition. Region is a
required query parameter for the templates listing.

## Create a deployment

```text
POST /api/v1/deployments
```

Minimal request using a template, with per-resource sizing overrides:

```json
{
  "name": "my-hosted-deployment",
  "region": "us-east-1",
  "version": "8.15.0",
  "resources": {
    "elasticsearch": [
      {
        "region": "us-east-1",
        "ref_id": "main-elasticsearch",
        "plan": {
          "cluster_topology": [
            {
              "zone_count": 2,
              "size": { "value": 4096, "resource": "memory" },
              "instance_configuration_id": "aws.es.datahot"
            }
          ],
          "elasticsearch": { "version": "8.15.0" }
        }
      }
    ],
    "kibana": [
      {
        "region": "us-east-1",
        "ref_id": "main-kibana",
        "elasticsearch_cluster_ref_id": "main-elasticsearch",
        "plan": {
          "cluster_topology": [{ "zone_count": 1, "size": { "value": 1024, "resource": "memory" } }],
          "kibana": { "version": "8.15.0" }
        }
      }
    ]
  }
}
```

Alternatively pass a `template_id`; any resources supplied in the request override the template's defaults (no merging
is performed for a given resource kind that is present in the request).

| Field       | Type   | Required | Description                                                        |
| ----------- | ------ | -------- | ------------------------------------------------------------------ |
| `name`      | string | Yes      | Human-readable deployment name                                     |
| `region`    | string | Yes      | Region ID (for example, `us-east-1`, `gcp-us-central1`); permanent |
| `version`   | string | No       | Elastic Stack version (defaults to latest for the region)          |
| `resources` | object | Yes\*    | Resource definitions; \*not required when `template_id` is used    |

### Creation response

The response includes the deployment `id`, the created resources, and — **once** — the `elastic` user credentials:

```json
{
  "id": "abc123def456...",
  "name": "my-hosted-deployment",
  "resources": [
    {
      "kind": "elasticsearch",
      "ref_id": "main-elasticsearch",
      "credentials": { "username": "elastic", "password": "REDACTED" }
    }
  ]
}
```

Persist the credentials into a CLI context (OS keychain) — never echo the password in chat. The `elastic` bootstrap user
is for mining a scoped Elasticsearch API key (`POST /_security/api_key`); use that key for ongoing data-plane work.

## Update, shut down, restore

- **Update** (`PUT /api/v1/deployments/{id}`) resizes topology, upgrades the stack version, or reconfigures resources.
  Send the full intended plan for the resources being changed.
- **Shut down** (`POST /api/v1/deployments/{id}/_shutdown`) stops all resources; data is retained per snapshot policy.
  Optional `skip_snapshot` and (admin-only) `hide` query parameters apply.
- **Restore** (`POST /api/v1/deployments/{id}/_restore`) brings a shut-down deployment back; `restore_snapshot` controls
  whether a snapshot is restored for eligible resources.

## Traffic-filter rulesets (hosted)

Hosted deployments use **traffic-filter rulesets**, managed separately from Serverless traffic filters:

| Method   | Path                                               | Description                           |
| -------- | -------------------------------------------------- | ------------------------------------- |
| `GET`    | `/api/v1/deployments/traffic-filter/rulesets`      | List rulesets                         |
| `POST`   | `/api/v1/deployments/traffic-filter/rulesets`      | Create a ruleset                      |
| `GET`    | `/api/v1/deployments/traffic-filter/rulesets/{id}` | Get a ruleset                         |
| `PUT`    | `/api/v1/deployments/traffic-filter/rulesets/{id}` | Update a ruleset                      |
| `DELETE` | `/api/v1/deployments/traffic-filter/rulesets/{id}` | Delete a ruleset                      |
| `POST`   | `/api/v1/deployments/traffic-filter/associations`  | Associate a ruleset with a deployment |

Do not mix these with the Serverless `/api/v1/serverless/traffic-filters` endpoints — they are different APIs for
different products.
traffic-filters.md 10.8 KB
# Cloud Provisioning — Traffic Filters API Reference

All Serverless traffic filter API calls use base URL `https://api.elastic-cloud.com` and require the header
`Authorization: ApiKey $EC_API_KEY`.

> **Note:** The API uses the term "traffic filters" in endpoint paths and JSON fields. The parent skill uses "network
> security" as the umbrella term. Both refer to the same concept.

## Table of Contents

- [Traffic Filters](#traffic-filters)
  - [List traffic filters](#list-traffic-filters)
  - [Create a traffic filter](#create-a-traffic-filter)
  - [Get a traffic filter](#get-a-traffic-filter)
  - [Update a traffic filter](#update-a-traffic-filter)
  - [Delete a traffic filter](#delete-a-traffic-filter)
- [PrivateLink Metadata](#privatelink-metadata)
  - [List PrivateLink region metadata](#list-privatelink-region-metadata)
- [Schemas](#schemas)
  - [TrafficFilterRequest](#trafficfilterrequest)
  - [PatchTrafficFilterRequest](#patchtrafficfilterrequest)
  - [TrafficFilterRule](#trafficfilterrule)
  - [TrafficFilterInfo](#trafficfilterinfo)
- [Project Association](#project-association)

---

## Traffic Filters

> **Official API docs:**
> [Serverless traffic filter endpoints](https://www.elastic.co/docs/api/doc/elastic-cloud-serverless/group/endpoint-traffic-filters)

### List traffic filters

```text
GET /api/v1/serverless/traffic-filters
```

Returns all traffic filters for the authenticated organization.

**Query parameters:**

| Parameter            | Type    | Required | Description                             |
| -------------------- | ------- | -------- | --------------------------------------- |
| `region`             | string  | No       | Limit results to this region only       |
| `include_by_default` | boolean | No       | Filter by the `include_by_default` flag |

**Response (200):**

```json
{
  "items": [
    {
      "id": "tf-12345",
      "name": "Office IP allowlist",
      "description": "Allow office network",
      "type": "ip",
      "include_by_default": false,
      "region": "us-east-1",
      "rules": [{ "source": "203.0.113.0/24", "description": "Office network" }]
    }
  ]
}
```

### Create a traffic filter

```text
POST /api/v1/serverless/traffic-filters
```

Creates a traffic filter consisting of a set of rules.

**Request body:** [TrafficFilterRequest](#trafficfilterrequest)

**Response (201):** [TrafficFilterInfo](#trafficfilterinfo) — includes the generated `id`.

**Example — IP filter:**

```json
{
  "name": "Office IPs",
  "description": "Corporate office allowlist",
  "type": "ip",
  "region": "us-east-1",
  "include_by_default": false,
  "rules": [
    { "source": "203.0.113.0/24", "description": "Office network" },
    { "source": "198.51.100.5", "description": "VPN gateway" }
  ]
}
```

**Example — VPC filter (AWS PrivateLink):**

```json
{
  "name": "Production VPC",
  "description": "Restrict to production VPC endpoint",
  "type": "vpce",
  "region": "us-east-1",
  "include_by_default": false,
  "rules": [{ "source": "vpce-0abc123def456", "description": "Production VPC endpoint" }]
}
```

### Get a traffic filter

```text
GET /api/v1/serverless/traffic-filters/{id}
```

Retrieves a single traffic filter by ID.

**Path parameters:**

| Parameter | Type   | Required | Description           |
| --------- | ------ | -------- | --------------------- |
| `id`      | string | Yes      | The traffic filter ID |

**Response (200):** [TrafficFilterInfo](#trafficfilterinfo)

### Update a traffic filter

```text
PATCH /api/v1/serverless/traffic-filters/{id}
```

Partially updates a traffic filter. Only include the fields to change.

**Path parameters:**

| Parameter | Type   | Required | Description           |
| --------- | ------ | -------- | --------------------- |
| `id`      | string | Yes      | The traffic filter ID |

**Request body:** [PatchTrafficFilterRequest](#patchtrafficfilterrequest)

**Response (200):** [TrafficFilterInfo](#trafficfilterinfo)

> **Important:** When updating `rules`, provide the **complete** rule set. Any rules not included in the update are
> removed. To add a rule, include all existing rules plus the new one.

### Delete a traffic filter

```text
DELETE /api/v1/serverless/traffic-filters/{id}
```

Deletes a traffic filter by ID. Fails with `400` if the filter is still associated with a project. Disassociate the
filter from all projects first using the project PATCH endpoint.

**Path parameters:**

| Parameter | Type   | Required | Description           |
| --------- | ------ | -------- | --------------------- |
| `id`      | string | Yes      | The traffic filter ID |

**Response (200):** Empty response on success.

**Error (400):** Returns an error if the filter is associated with a project:

```json
{
  "errors": [{ "message": "traffic filter is associated with <project-id>, remove the association first" }]
}
```

---

## PrivateLink Metadata

> **Official API docs:**
> [Serverless traffic filter endpoints](https://www.elastic.co/docs/api/doc/elastic-cloud-serverless/group/endpoint-traffic-filters)

### List PrivateLink region metadata

```text
GET /api/v1/serverless/traffic-filters/metadata
```

Returns region-specific PrivateLink connectivity metadata (service names, domain names, availability zones). Use this to
look up the VPC service name needed when creating a VPC endpoint in the AWS console.

**Query parameters:**

| Parameter | Type   | Required | Description                          |
| --------- | ------ | -------- | ------------------------------------ |
| `region`  | string | No       | Filter metadata to a specific region |

**Response (200):**

```json
{
  "regions": [
    {
      "region": "us-east-1",
      "service_name": "com.amazonaws.vpce.us-east-1.vpce-svc-...",
      "domain_name": "private.us-east-1.aws.elastic.cloud",
      "availability_zones": ["use1-az2", "use1-az4", "use1-az6"]
    }
  ]
}
```

---

## Schemas

### TrafficFilterRequest

Used when creating a traffic filter (`POST`).

| Field                | Type    | Required | Description                                                         |
| -------------------- | ------- | -------- | ------------------------------------------------------------------- |
| `name`               | string  | Yes      | Display name for the filter                                         |
| `description`        | string  | No       | Human-readable description                                          |
| `type`               | string  | No       | `ip` (default) or `vpce`                                            |
| `region`             | string  | Yes      | AWS region the filter applies to                                    |
| `include_by_default` | boolean | No       | Auto-associate with all new projects in the region (default: false) |
| `rules`              | array   | No       | List of [TrafficFilterRule](#trafficfilterrule) objects             |

### PatchTrafficFilterRequest

Used when updating a traffic filter (`PATCH`). All fields are optional; only included fields are updated.

| Field                | Type    | Required | Description                                                                  |
| -------------------- | ------- | -------- | ---------------------------------------------------------------------------- |
| `name`               | string  | No       | Updated display name                                                         |
| `description`        | string  | No       | Updated description                                                          |
| `include_by_default` | boolean | No       | Updated auto-association flag                                                |
| `rules`              | array   | No       | Complete replacement list of [TrafficFilterRule](#trafficfilterrule) objects |

> `type` and `region` cannot be changed after creation.

### TrafficFilterRule

A single rule within a traffic filter.

| Field         | Type   | Required | Description                                                                  |
| ------------- | ------ | -------- | ---------------------------------------------------------------------------- |
| `source`      | string | No       | IP address, CIDR block (for `ip` type), or VPC endpoint ID (for `vpce` type) |
| `description` | string | No       | Human-readable description of this rule                                      |

### TrafficFilterInfo

Returned by all read and write operations. Extends [TrafficFilterRequest](#trafficfilterrequest) with an `id` field.

| Field                | Type    | Description                                             |
| -------------------- | ------- | ------------------------------------------------------- |
| `id`                 | string  | Unique traffic filter ID (generated by the API)         |
| `name`               | string  | Display name                                            |
| `description`        | string  | Human-readable description                              |
| `type`               | string  | `ip` or `vpce`                                          |
| `include_by_default` | boolean | Auto-association flag                                   |
| `region`             | string  | AWS region                                              |
| `rules`              | array   | List of [TrafficFilterRule](#trafficfilterrule) objects |

---

## Project Association

> **Official API docs:**
> [Patch Elasticsearch project](https://www.elastic.co/docs/api/doc/elastic-cloud-serverless/operation/operation-patchelasticsearchproject)
> ·
> [Patch Observability project](https://www.elastic.co/docs/api/doc/elastic-cloud-serverless/operation/operation-patchobservabilityproject)
> ·
> [Patch Security project](https://www.elastic.co/docs/api/doc/elastic-cloud-serverless/operation/operation-patchsecurityproject)

Traffic filters are associated with Serverless projects using the **project PATCH endpoint**, not through the traffic
filter API. This skill handles that association in its Serverless projects workflow (the project PATCH operation).

### Associate a filter with a project

```text
PATCH /api/v1/serverless/projects/{type}/{id}
```

Include the `traffic_filters` field with the **complete list** of filter IDs to associate:

```json
{
  "traffic_filters": [{ "id": "tf-12345" }, { "id": "tf-67890" }]
}
```

Any filter ID not included in the list is disassociated from the project. To remove all filters, send an empty array.

### List projects associated with a filter

```text
GET /api/v1/serverless/projects/{type}?traffic_filter={filter-id}
```

Returns projects that have the specified filter associated.

### Include filters at project creation

```text
POST /api/v1/serverless/projects/{type}
```

Include `traffic_filters` in the creation request body to associate filters from the start:

```json
{
  "name": "my-project",
  "region_id": "us-east-1",
  "traffic_filters": [{ "id": "tf-12345" }]
}
```

For full project creation and management schemas, see [api-reference.md](api-reference.md).

License (Apache-2.0)

View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/elastic/agent-skills/blob/main/LICENSE