OpenSearch Serverless Deployer
What this skill does
Provisions Amazon OpenSearch Serverless collections with secure defaults —
encryption policy created BEFORE the collection (KMS key is immutable
post-creation), network policy preceding collection creation, data access
policy using IAM principals (never resource-based), standby replicas
enabled for HA, OCU floor at 4 (2 indexing + 2 search) for production, and
lifecycle policies for timeseries/vectorsearch retention. Runs deterministic
pre-checks before any state-changing CLI, emits the exact create-collection
and create-security-policy CLIs behind a CONFIRM gate, and verifies the
collection via list-collections. Every plan surfaces the encryption-first
ordering rule, the network-policy-before-collection rule, the data-access-
policy vs resource-policy distinction, and the OCU cost floor.
Quick navigation
| Section |
What it covers |
When to read it |
| Quick reference |
Verdict thresholds + pre-check priority order + collection type matrix |
Before any operation |
| Mindset |
Why encryption-first ordering matters; immutable collection fields; OCU cost floor |
Understanding the deployment model |
| Pre-flight |
Collection metadata gate — KMS key, VPC subnets, SAML metadata, IAM permissions |
Before executing any CLI |
| Process |
Per-operation planning: encryption, network, lifecycle, collection, VPC endpoint, access |
When choosing which operation |
| STRICT output contract |
Required COLLECTION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY block |
Formatting the response |
| NEVER (top 5) |
Hard rules that prevent common insecure or broken patterns |
Review before deploy |
| Expert heuristic |
Choosing collection type and OCU capacity per use case |
Sizing and type selection |
Quick reference — verdict thresholds
| Verdict |
Trigger condition |
Action |
PREREQUISITES_MISSING |
Any pre-check failed (encryption policy missing or wrong key type, network policy missing, VPC subnets invalid, SAML metadata unreachable, IAM permission missing, collection name collision, standby replicas disabled in production, OCU floor below 4, attempting to change immutable field on update) |
List failures, do NOT execute |
READY_TO_DEPLOY |
All pre-checks passed; awaiting CONFIRM gate |
Emit exact CLI sequence with full collection config, wait for operator yes |
Priority order for pre-checks (apply in this sequence, all must pass for
READY_TO_DEPLOY):
- Collection name uniqueness —
list-collections returns no match (for
create) or matches exactly one (for update).
- Encryption policy exists — a security policy of type
encryption
with a matching pattern exists BEFORE collection creation. Without it,
the collection uses the AWS-owned key and cannot be changed after.
- KMS key is symmetric — if the encryption policy references a
customer-managed KMS key, it MUST be
SYMMETRIC_DEFAULT.
- Network policy exists — a security policy of type
network covering
the collection pattern exists BEFORE creation. Without it, the collection
is unreachable.
- Standby replicas — for production,
StandbyReplicas: ENABLED. Doubles
the OCU cost but survives an AZ failure. DISABLED is dev/staging only.
- OCU floor — minimum 2 indexing + 2 search OCUs (4 total) for
production. Below this, the collection cannot handle concurrency.
- VPC subnets — if VPC access, the VPC ID and subnet IDs resolve and
security groups exist.
- Data access policy — at least one IAM principal has collection-level
and document-level grants. Without it, the collection is unreachable.
- SAML metadata (if SAML auth) — the metadata URL or XML is reachable
and parses as valid SAML 2.0.
- Lifecycle policy (timeseries) — a
lifecycle policy covering the
collection pattern exists. Without it, data accumulates indefinitely.
Mindset
One-line takeaway: an OpenSearch Serverless collection is not "an
Elasticsearch cluster that scales itself" — it is a policy-ordered
deployment where the encryption and network policies MUST exist BEFORE
the collection, the KMS key choice is immutable post-creation, and the OCU
floor determines both cost and availability.
Three facts make OpenSearch Serverless provisioning different from managed
OpenSearch:
Encryption policy MUST exist before collection creation. The KMS key
referenced is bound at creation time and CANNOT be changed. If no
encryption policy matches, OpenSearch Serverless silently uses an AWS-owned
key — acceptable but opaque (no CloudTrail key usage, no rotation
visibility). Operators who want customer-managed KMS must create the
encryption policy FIRST.
Network policy MUST exist before collection creation. A collection
without a matching network policy is unreachable — neither public nor VPC
endpoints can connect. Creating the collection first and adding the network
policy later leaves it unusable until propagation (5-15 minutes).
OCU is the cost floor, not the ceiling. OpenSearch Serverless bills by
OCU-hour whether idle or busy. Minimum 4 OCUs (2 indexing + 2 search) at
~$0.204/OCU-hour = ~$590/month baseline. Standby replicas double it. Sizing
the floor correctly is the #1 cost control.
Quick reference — collection type matrix
| Type |
Use case |
Lifecycle |
k-NN |
SEARCH |
Full-text search, catalog, document search |
Optional |
Limited |
TIMESERIES |
Logs, metrics, IoT with time-based retention |
Required (retention + storage transition) |
No |
VECTORSEARCH |
Vector similarity, semantic search, RAG |
Optional (size-based) |
Yes (primary use case) |
Pre-flight: collection deployment gate
Before producing the deployment plan, validate the input specification.
Several requirements block deployment.
Live-account pre-flight checks (skip if offline architecture plan):
- Verify IAM permissions for
opensearchserverless:CreateCollection,
CreateSecurityPolicy, CreateAccessPolicy, CreateVpcEndpoint.
- Verify the encryption security policy exists:
aws opensearchserverless list-security-policies --type encryption
- Verify the network security policy exists:
aws opensearchserverless list-security-policies --type network
- For VPC access, verify VPC ID, subnet IDs, security group IDs resolve.
- For SAML auth, verify the SAML metadata URL is reachable.
- Verify KMS key (if customer-managed) is
SYMMETRIC_DEFAULT:
aws kms describe-key --key-id <id> --query 'KeyMetadata.KeySpec'
If the deployment spec is incomplete, output:
COLLECTION: <name-or-unknown>
VERDICT: PREREQUISITES_MISSING
REASON: Deployment specification is missing required fields (<list>).
REQUIRED:
- collection_type (SEARCH | TIMESERIES | VECTORSEARCH)
- encryption (aws-owned-key | customer-managed-kms:arn)
- network (public | vpc:vpc-id:subnet-ids:security-group-ids)
- ocu_floor (minimum 4 for production: 2 indexing + 2 search)
- standby_replicas (ENABLED for production HA)
- access_principals (IAM role ARNs with data access grants)
Process — Architecture planning (apply in order)
Step 0: Expert knowledge — non-obvious behaviors
Moved verbatim to references/advanced-patterns.md — load on demand.
Read it only when this section applies.
Step 1: Collection type selection
| Type |
When to use |
Notes |
SEARCH |
Full-text, catalog, document search |
Standard indexes; optional lifecycle |
TIMESERIES |
Logs, metrics with retention |
Time-partitioned; lifecycle REQUIRED |
VECTORSEARCH |
Semantic search, RAG, recommendations |
k-NN (faiss/nmslib); lifecycle optional |
Anti-pattern: NEVER use SEARCH for time-based log retention. Without
lifecycle policies, logs accumulate indefinitely. Use TIMESERIES.
Step 2: Encryption policy (create BEFORE collection)
aws opensearchserverless create-security-policy \
--name prod-encryption --type encryption \
--policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"KmsKeyArn":"arn:aws:kms:us-east-1:111111111111:key/abc-123"}'
KMS key requirements:
- MUST be
SYMMETRIC_DEFAULT (no asymmetric keys).
- Key policy MUST grant
kms:Decrypt, kms:DescribeKey, kms:CreateGrant
to opensearch-serverless.amazonaws.com.
- For AWS-owned key, omit
KmsKeyArn.
Step 3: Network policy (create BEFORE collection)
aws opensearchserverless create-security-policy \
--name prod-network --type network \
--policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"AllowFromPublic":true}'
For VPC-only: replace AllowFromPublic with "SourceVPCEs": ["vpce-abc123"].
Step 4: Data lifecycle policy (TIMESERIES)
aws opensearchserverless create-lifecycle-policy \
--name prod-lifecycle --type retention \
--policy '{"Rules":[{"ResourceType":"index","Resource":{"index":"prod-logs-*"},"MinIndexRetention":"7d","MaxIndexRetention":"30d"}]}'
Step 5: Collection creation
aws opensearchserverless create-collection \
--name prod-vectors --type VECTORSEARCH \
--description "Production vector search for RAG" \
--standby-replicas ENABLED
Creation takes 15-30 minutes (CREATING → ACTIVE). Default OCU floor is 4
(2 indexing + 2 search).
Step 6: VPC endpoint (if VPC network)
aws opensearchserverless create-vpc-endpoint \
--name prod-vpce --vpc-id vpc-abc123 \
--subnet-ids subnet-aaa subnet-bbb \
--security-group-ids sg-abc123 \
--collection-endpoints <endpoint-from-step-5>
Step 7: Data access policy (IAM principals)
aws opensearchserverless create-access-policy \
--name prod-access --type data \
--policy '[{"Permission":["aoss:CreateCollectionItems","aoss:DescribeCollectionItems"],"Principal":["arn:aws:iam::111111111111:role/AppRole"]}]'
The collection creator does NOT automatically get access. A data access
policy MUST be created.
Step 8: SAML / IAM Identity Center authentication
aws opensearchserverless update-collection \
--id <collection-id> \
--saml-options '{"Metadata":{"URL":"https://identity-center.amazonaws.com/saml/metadata/abc"},"GroupAttribute":"department","SessionTimeout":60}'
Step 9: Capacity configuration (OCU)
aws opensearchserverless update-collection \
--id <collection-id> \
--capacity '{"CapacityLimits":{"MaxIndexingCapacityInOCU":8,"MaxSearchCapacityInOCU":8}}'
Step 10: Vector search and semantic search
For VECTORSEARCH collections, the application creates the k-NN index:
{
"settings": {"index": {"knn": true}},
"mappings": {"properties": {"embedding": {
"type": "knn_vector", "dimension": 1536,
"method": {"name": "hnsw", "space_type": "cosinesimil", "engine": "faiss",
"parameters": {"ef_construction": 128, "m": 24}}
}}}
}
Engine: faiss (recommended; HNSW + IVF) or nmslib (legacy).
Semantic search: register an ML connector to Bedrock Titan Embeddings
via ML Commons, then create a neural search pipeline that calls the model
at ingest and query time.
Output format (per collection deployment plan)
COLLECTION: <name>
VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING
ARCHITECTURE:
Type: <SEARCH | TIMESERIES | VECTORSEARCH>
Encryption: <customer-managed KMS ARN | aws-owned-key>
Network: <public | VPC vpce-xxx>
Standby replicas: <ENABLED | DISABLED>
OCU floor: <indexing> indexing + <search> search = <total>
Access: <IAM principal count> principals via data access policy
Auth: <SAML | IAM-only>
Lifecycle: <retention rules | none>
Vector: <k-NN engine + dimension | N/A>
CHECKLIST:
[x] Encryption policy exists and references symmetric KMS key
[x] Network policy exists and covers collection pattern
[x] Collection type matches use case
[x] Standby replicas ENABLED for production HA
[x] OCU floor >= 4 (2 indexing + 2 search)
[x] Data access policy with IAM principals
[x] VPC endpoint configured (if VPC network)
[x] SAML metadata reachable (if SAML auth)
[x] Lifecycle policy for retention (TIMESERIES required)
FINDINGS:
- [INFO] Estimated monthly cost: OCU floor <N> x $0.204/hr x 720 = $<X>
- [WARN] Standby replicas ENABLED doubles OCU cost
DEPLOY_COMMANDS:
<ordered list of aws opensearchserverless commands>
STRICT output contract
Required output structure
Every response MUST begin with this block — no preamble:
COLLECTION: <name>
VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING
TARGET: <name> (collection-id: <id> for updates)
PRE_CHECKS:
- [PASS] <check description>
- [FAIL] <check description> — <reason>
STEPS:
1. CONFIRM: About to <operation> collection <name> in account <account> region <region>. This will <consequence>. Proceed? (yes/no)
2. <exact CLI command — no placeholders>
POST_VERIFY:
- [PASS] <verification description>
- [FAIL] <verification description> — <reason>
TYPE: SEARCH | TIMESERIES | VECTORSEARCH
ENCRYPTION: <KMS ARN | aws-owned-key>
NETWORK: <public | VPC vpce-xxx>
OCU: <indexing> indexing + <search> search (<standby> standby)
ACCESS: <count> IAM principals
AUTH: <SAML | IAM-only>
LIFECYCLE: <retention rules | none>
NOTES: <security posture, cost estimate, capacity caveats>
FORBIDDEN output patterns
- NEVER start with "Let me analyze…" — the VERDICT block is the FIRST line.
- NEVER use lowercase verdict values — emit
READY_TO_DEPLOY or
PREREQUISITES_MISSING.
- NEVER omit PRE_CHECKS — every pre-check must appear with
[PASS] or
[FAIL] and a specific reason.
- NEVER emit placeholder values in a READY_TO_DEPLOY plan.
- NEVER omit the CONFIRM gate as the first STEPS entry.
- NEVER claim success without verifying ACTIVE via
batch-get-collection.
- NEVER change CLI step order — encryption first, network second, collection
third.
- NEVER silently allow AWS-owned key for compliance workloads — flag as
[WARN].
Perfect example output
COLLECTION: prod-vectors
VERDICT: READY_TO_DEPLOY
TARGET: prod-vectors
PRE_CHECKS:
- [PASS] Collection name unique
- [PASS] Encryption policy prod-encryption exists, references KMS abc-123
- [PASS] KMS key abc-123 is SYMMETRIC_DEFAULT
- [PASS] Network policy prod-network exists, covers collection/prod-*
- [PASS] VPC subnets resolve in vpc-abc123
- [PASS] Standby replicas ENABLED for production HA
- [PASS] OCU floor 4 (2 indexing + 2 search)
- [PASS] Data access policy prod-access has 3 IAM principals
- [PASS] SAML metadata URL reachable
- [PASS] IAM principal holds opensearchserverless:CreateCollection
STEPS:
1. CONFIRM: About to create-collection prod-vectors in account 111111111111 region us-east-1. VECTORSEARCH with KMS, VPC, SAML, standby replicas. Estimated monthly cost: $1175 (4 OCU x 2 standby x $0.204/hr x 720). Takes 15-30 min. Proceed? (yes/no)
2. aws opensearchserverless create-security-policy --name prod-encryption --type encryption --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"KmsKeyArn":"arn:aws:kms:us-east-1:111111111111:key/abc-123"}'
3. aws opensearchserverless create-security-policy --name prod-network --type network --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"SourceVPCEs":["vpce-xyz123"]}'
4. aws opensearchserverless create-collection --name prod-vectors --type VECTORSEARCH --description "Production vector search for RAG" --standby-replicas ENABLED
5. aws opensearchserverless create-access-policy --name prod-access --type data --policy '[{"Permission":["aoss:CreateCollectionItems","aoss:DescribeCollectionItems"],"Principal":["arn:aws:iam::111111111111:role/AppRole"]}]'
6. aws opensearchserverless create-vpc-endpoint --name prod-vpce --vpc-id vpc-abc123 --subnet-ids subnet-aaa subnet-bbb --security-group-ids sg-abc123 --collection-endpoints <endpoint-from-step-4>
POST_VERIFY:
- (pending execution)
- batch-get-collection returns status=ACTIVE (wait 15-30 min)
- get-security-policy returns prod-encryption with KMS abc-123
TYPE: VECTORSEARCH
ENCRYPTION: arn:aws:kms:us-east-1:111111111111:key/abc-123
NETWORK: VPC vpce-xyz123
OCU: 2 indexing + 2 search (standby doubles to 8 effective)
ACCESS: 3 IAM principals
AUTH: SAML via IAM Identity Center
LIFECYCLE: none (VECTORSEARCH)
NOTES:
- KMS key is immutable post-creation.
- Standby replicas double OCU cost ($1175/mo vs $588/mo).
- Data access policy required — creator gets NO default access.
Verification commands (run after deployment)
Moved verbatim to references/diagnostic-commands.md — load on demand.
Read it only when this section applies.
Edge-case handling
Moved verbatim to references/advanced-patterns.md — load on demand.
Read it only when this section applies.
NEVER (top 5)
NEVER create the collection before the encryption policy. The KMS key
is IMMUTABLE post-creation. Without a matching encryption policy, the
collection silently uses an AWS-owned key with no key visibility. Create
the encryption policy FIRST, always.
NEVER create the collection before the network policy. Without a
matching network policy, the collection endpoint is unreachable — neither
public nor VPC. Takes 5-15 min to propagate after creation.
NEVER omit the data access policy. OpenSearch Serverless uses IAM
principals via data access policies, NOT resource-based policies. The
creator gets NO default access. Always emit create-access-policy.
NEVER use an asymmetric KMS key. Requires SYMMETRIC_DEFAULT.
Asymmetric keys fail with an opaque error. Verify via
kms describe-key --query 'KeyMetadata.KeySpec'.
NEVER disable standby replicas for production. Without standby, an AZ
failure causes complete downtime. ENABLED doubles OCU cost but is required
for HA. DISABLED is dev/staging only.
Expert heuristic: choosing collection type and OCU capacity
Moved verbatim to references/capacity-and-encryption-guide.md — load on demand.
Read it only when this section applies.
Recent AWS features (2024-2026)
Moved verbatim to references/advanced-patterns.md — load on demand.
Read it only when this section applies.
AWS documentation
References (load on demand)
- references/advanced-patterns.md — Step 0 non-obvious behaviors, edge cases, recent AWS features
- references/diagnostic-commands.md — post-deployment verification commands
- references/capacity-and-encryption-guide.md — collection type and OCU capacity heuristics
- references/vector-search-guide.md — vector search detail
Domain
AWS CloudOps / OpenSearch Serverless Analytics & Vector Search Provisioning.
1---2name: opensearch-serverless-deployer3description: Provisions Amazon OpenSearch Serverless collections with secure defaults — collection type selection (SEARCH, TIMESERIES, VECTORSEARCH), encryption policy with customer-managed KMS (must exist before collection), network policy (public or VPC-only), data lifecycle policy (retention), capacity (OCU, min 4 for HA, auto-scaling), standby replicas, SAML / IAM Identity Center authentication, data access policies (IAM principals), VPC endpoints, vector search (k-NN, faiss, nmslib), semantic search with Bedrock embeddings, and flow frameworks. Runs deterministic pre-checks (encryption-policy-first ordering, KMS symmetric key, network policy precedes collection, OCU minimum, SAML metadata URL), emits create- collection CLIs behind a CONFIRM gate, verifies via list-collections. Emits READY_TO_DEPLOY | PREREQUISITES_MISSING. Use when provisioning OpenSearch Serverless, configuring vector search, or setting up semantic search collections.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline plan classification. Live-account operations use aws opensearchserverless create-security-policy (encryption, network), create-collection, create-vpc-endpoint, create-access-policy, update-collection, list-collections, batch-get-collection (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/opensearch-serverless-deployer8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '1'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Analytics15 task_type: deploy16 skill_class: capability17 lifecycle_status: active18 verdict_shape: READY_TO_DEPLOY | PREREQUISITES_MISSING19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 tags: opensearch, analytics, deploy, serverless, vector-search, kms, vpc, saml, semantic-search, collection22 dependencies: aws-orchestrator23 keywords: OpenSearch Serverless, collection, VECTORSEARCH, SEARCH, TIMESERIES, OCU, OpenSearch Compute Units, encryption policy, network policy, data lifecycle policy, access policy, KMS, VPC endpoint, SAML, IAM Identity Center, k-NN, faiss, vector search, semantic search, flow frameworks, standby replicas24 when_to_use: Provisioning a new OpenSearch Serverless collection (SEARCH, TIMESERIES, or VECTORSEARCH), configuring encryption with customer-managed KMS, setting up VPC-only network access, enabling SAML or IAM Identity Center authentication, defining data lifecycle policies, sizing OCU capacity, deploying vector or semantic search, or wiring flow frameworks.25 activation_triggers: create OpenSearch Serverless collection, provision vector search collection, OpenSearch Serverless with KMS, OpenSearch Serverless VPC endpoint, semantic search collection, k-NN vector index, OpenSearch Serverless SAML auth, OCU capacity planning, flow frameworks OpenSearch, opensearchserverless create-collection26 invocation_schema: 'Input: either (a) a collection deployment intent (create, update) with target collection name, type (SEARCH / TIMESERIES / VECTORSEARCH), encryption, network, capacity, access, lifecycle, and optional vector config; OR (b) a collection id for live-account update or validation. Output: deterministic COLLECTION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY block per operation, where VERDICT is one of READY_TO_DEPLOY, PREREQUISITES_MISSING.'27---2829# OpenSearch Serverless Deployer3031## What this skill does3233Provisions Amazon OpenSearch Serverless collections with secure defaults —34encryption policy created BEFORE the collection (KMS key is immutable35post-creation), network policy preceding collection creation, data access36policy using IAM principals (never resource-based), standby replicas37enabled for HA, OCU floor at 4 (2 indexing + 2 search) for production, and38lifecycle policies for timeseries/vectorsearch retention. Runs deterministic39pre-checks before any state-changing CLI, emits the exact `create-collection`40and `create-security-policy` CLIs behind a CONFIRM gate, and verifies the41collection via `list-collections`. Every plan surfaces the encryption-first42ordering rule, the network-policy-before-collection rule, the data-access-43policy vs resource-policy distinction, and the OCU cost floor.4445## Quick navigation4647| Section | What it covers | When to read it |48|---|---|---|49| **Quick reference** | Verdict thresholds + pre-check priority order + collection type matrix | Before any operation |50| **Mindset** | Why encryption-first ordering matters; immutable collection fields; OCU cost floor | Understanding the deployment model |51| **Pre-flight** | Collection metadata gate — KMS key, VPC subnets, SAML metadata, IAM permissions | Before executing any CLI |52| **Process** | Per-operation planning: encryption, network, lifecycle, collection, VPC endpoint, access | When choosing which operation |53| **STRICT output contract** | Required COLLECTION/VERDICT/PRE_CHECKS/STEPS/POST_VERIFY block | Formatting the response |54| **NEVER (top 5)** | Hard rules that prevent common insecure or broken patterns | Review before deploy |55| **Expert heuristic** | Choosing collection type and OCU capacity per use case | Sizing and type selection |5657## Quick reference — verdict thresholds5859| Verdict | Trigger condition | Action |60|---|---|---|61| `PREREQUISITES_MISSING` | Any pre-check failed (encryption policy missing or wrong key type, network policy missing, VPC subnets invalid, SAML metadata unreachable, IAM permission missing, collection name collision, standby replicas disabled in production, OCU floor below 4, attempting to change immutable field on update) | List failures, do NOT execute |62| `READY_TO_DEPLOY` | All pre-checks passed; awaiting CONFIRM gate | Emit exact CLI sequence with full collection config, wait for operator yes |6364**Priority order for pre-checks (apply in this sequence, all must pass for65READY_TO_DEPLOY):**66671. **Collection name uniqueness** — `list-collections` returns no match (for68 create) or matches exactly one (for update).692. **Encryption policy exists** — a security policy of type `encryption`70 with a matching pattern exists BEFORE collection creation. Without it,71 the collection uses the AWS-owned key and cannot be changed after.723. **KMS key is symmetric** — if the encryption policy references a73 customer-managed KMS key, it MUST be `SYMMETRIC_DEFAULT`.744. **Network policy exists** — a security policy of type `network` covering75 the collection pattern exists BEFORE creation. Without it, the collection76 is unreachable.775. **Standby replicas** — for production, `StandbyReplicas: ENABLED`. Doubles78 the OCU cost but survives an AZ failure. DISABLED is dev/staging only.796. **OCU floor** — minimum 2 indexing + 2 search OCUs (4 total) for80 production. Below this, the collection cannot handle concurrency.817. **VPC subnets** — if VPC access, the VPC ID and subnet IDs resolve and82 security groups exist.838. **Data access policy** — at least one IAM principal has collection-level84 and document-level grants. Without it, the collection is unreachable.859. **SAML metadata (if SAML auth)** — the metadata URL or XML is reachable86 and parses as valid SAML 2.0.8710. **Lifecycle policy (timeseries)** — a `lifecycle` policy covering the88 collection pattern exists. Without it, data accumulates indefinitely.8990## Mindset9192**One-line takeaway:** an OpenSearch Serverless collection is not "an93Elasticsearch cluster that scales itself" — it is a **policy-ordered94deployment** where the encryption and network policies MUST exist BEFORE95the collection, the KMS key choice is immutable post-creation, and the OCU96floor determines both cost and availability.9798Three facts make OpenSearch Serverless provisioning different from managed99OpenSearch:100101- **Encryption policy MUST exist before collection creation.** The KMS key102 referenced is bound at creation time and CANNOT be changed. If no103 encryption policy matches, OpenSearch Serverless silently uses an AWS-owned104 key — acceptable but opaque (no CloudTrail key usage, no rotation105 visibility). Operators who want customer-managed KMS must create the106 encryption policy FIRST.107108- **Network policy MUST exist before collection creation.** A collection109 without a matching network policy is unreachable — neither public nor VPC110 endpoints can connect. Creating the collection first and adding the network111 policy later leaves it unusable until propagation (5-15 minutes).112113- **OCU is the cost floor, not the ceiling.** OpenSearch Serverless bills by114 OCU-hour whether idle or busy. Minimum 4 OCUs (2 indexing + 2 search) at115 ~$0.204/OCU-hour = ~$590/month baseline. Standby replicas double it. Sizing116 the floor correctly is the #1 cost control.117118## Quick reference — collection type matrix119120| Type | Use case | Lifecycle | k-NN |121|---|---|---|---|122| `SEARCH` | Full-text search, catalog, document search | Optional | Limited |123| `TIMESERIES` | Logs, metrics, IoT with time-based retention | Required (retention + storage transition) | No |124| `VECTORSEARCH` | Vector similarity, semantic search, RAG | Optional (size-based) | Yes (primary use case) |125126## Pre-flight: collection deployment gate127128Before producing the deployment plan, validate the input specification.129Several requirements **block deployment**.130131**Live-account pre-flight checks (skip if offline architecture plan):**1321. Verify IAM permissions for `opensearchserverless:CreateCollection`,133 `CreateSecurityPolicy`, `CreateAccessPolicy`, `CreateVpcEndpoint`.1342. Verify the encryption security policy exists:135 `aws opensearchserverless list-security-policies --type encryption`1363. Verify the network security policy exists:137 `aws opensearchserverless list-security-policies --type network`1384. For VPC access, verify VPC ID, subnet IDs, security group IDs resolve.1395. For SAML auth, verify the SAML metadata URL is reachable.1406. Verify KMS key (if customer-managed) is `SYMMETRIC_DEFAULT`:141 `aws kms describe-key --key-id <id> --query 'KeyMetadata.KeySpec'`142143**If the deployment spec is incomplete**, output:144145```text146COLLECTION: <name-or-unknown>147VERDICT: PREREQUISITES_MISSING148REASON: Deployment specification is missing required fields (<list>).149REQUIRED:150 - collection_type (SEARCH | TIMESERIES | VECTORSEARCH)151 - encryption (aws-owned-key | customer-managed-kms:arn)152 - network (public | vpc:vpc-id:subnet-ids:security-group-ids)153 - ocu_floor (minimum 4 for production: 2 indexing + 2 search)154 - standby_replicas (ENABLED for production HA)155 - access_principals (IAM role ARNs with data access grants)156```157158## Process — Architecture planning (apply in order)159160### Step 0: Expert knowledge — non-obvious behaviors161> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.162> Read it only when this section applies.163164165### Step 1: Collection type selection166167| Type | When to use | Notes |168|---|---|---|169| `SEARCH` | Full-text, catalog, document search | Standard indexes; optional lifecycle |170| `TIMESERIES` | Logs, metrics with retention | Time-partitioned; lifecycle REQUIRED |171| `VECTORSEARCH` | Semantic search, RAG, recommendations | k-NN (faiss/nmslib); lifecycle optional |172173**Anti-pattern:** NEVER use `SEARCH` for time-based log retention. Without174lifecycle policies, logs accumulate indefinitely. Use `TIMESERIES`.175176### Step 2: Encryption policy (create BEFORE collection)177178```bash179aws opensearchserverless create-security-policy \180 --name prod-encryption --type encryption \181 --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"KmsKeyArn":"arn:aws:kms:us-east-1:111111111111:key/abc-123"}'182```183184**KMS key requirements:**185- MUST be `SYMMETRIC_DEFAULT` (no asymmetric keys).186- Key policy MUST grant `kms:Decrypt`, `kms:DescribeKey`, `kms:CreateGrant`187 to `opensearch-serverless.amazonaws.com`.188- For AWS-owned key, omit `KmsKeyArn`.189190### Step 3: Network policy (create BEFORE collection)191192```bash193aws opensearchserverless create-security-policy \194 --name prod-network --type network \195 --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"AllowFromPublic":true}'196```197198For VPC-only: replace `AllowFromPublic` with `"SourceVPCEs": ["vpce-abc123"]`.199200### Step 4: Data lifecycle policy (TIMESERIES)201202```bash203aws opensearchserverless create-lifecycle-policy \204 --name prod-lifecycle --type retention \205 --policy '{"Rules":[{"ResourceType":"index","Resource":{"index":"prod-logs-*"},"MinIndexRetention":"7d","MaxIndexRetention":"30d"}]}'206```207208### Step 5: Collection creation209210```bash211aws opensearchserverless create-collection \212 --name prod-vectors --type VECTORSEARCH \213 --description "Production vector search for RAG" \214 --standby-replicas ENABLED215```216217Creation takes 15-30 minutes (CREATING → ACTIVE). Default OCU floor is 4218(2 indexing + 2 search).219220### Step 6: VPC endpoint (if VPC network)221222```bash223aws opensearchserverless create-vpc-endpoint \224 --name prod-vpce --vpc-id vpc-abc123 \225 --subnet-ids subnet-aaa subnet-bbb \226 --security-group-ids sg-abc123 \227 --collection-endpoints <endpoint-from-step-5>228```229230### Step 7: Data access policy (IAM principals)231232```bash233aws opensearchserverless create-access-policy \234 --name prod-access --type data \235 --policy '[{"Permission":["aoss:CreateCollectionItems","aoss:DescribeCollectionItems"],"Principal":["arn:aws:iam::111111111111:role/AppRole"]}]'236```237238The collection creator does NOT automatically get access. A data access239policy MUST be created.240241### Step 8: SAML / IAM Identity Center authentication242243```bash244aws opensearchserverless update-collection \245 --id <collection-id> \246 --saml-options '{"Metadata":{"URL":"https://identity-center.amazonaws.com/saml/metadata/abc"},"GroupAttribute":"department","SessionTimeout":60}'247```248249### Step 9: Capacity configuration (OCU)250251```bash252aws opensearchserverless update-collection \253 --id <collection-id> \254 --capacity '{"CapacityLimits":{"MaxIndexingCapacityInOCU":8,"MaxSearchCapacityInOCU":8}}'255```256257### Step 10: Vector search and semantic search258259For VECTORSEARCH collections, the application creates the k-NN index:260261```json262{263 "settings": {"index": {"knn": true}},264 "mappings": {"properties": {"embedding": {265 "type": "knn_vector", "dimension": 1536,266 "method": {"name": "hnsw", "space_type": "cosinesimil", "engine": "faiss",267 "parameters": {"ef_construction": 128, "m": 24}}268 }}}269}270```271272**Engine:** `faiss` (recommended; HNSW + IVF) or `nmslib` (legacy).273274**Semantic search:** register an ML connector to Bedrock Titan Embeddings275via ML Commons, then create a neural search pipeline that calls the model276at ingest and query time.277278## Output format (per collection deployment plan)279280```text281COLLECTION: <name>282VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING283ARCHITECTURE:284 Type: <SEARCH | TIMESERIES | VECTORSEARCH>285 Encryption: <customer-managed KMS ARN | aws-owned-key>286 Network: <public | VPC vpce-xxx>287 Standby replicas: <ENABLED | DISABLED>288 OCU floor: <indexing> indexing + <search> search = <total>289 Access: <IAM principal count> principals via data access policy290 Auth: <SAML | IAM-only>291 Lifecycle: <retention rules | none>292 Vector: <k-NN engine + dimension | N/A>293CHECKLIST:294 [x] Encryption policy exists and references symmetric KMS key295 [x] Network policy exists and covers collection pattern296 [x] Collection type matches use case297 [x] Standby replicas ENABLED for production HA298 [x] OCU floor >= 4 (2 indexing + 2 search)299 [x] Data access policy with IAM principals300 [x] VPC endpoint configured (if VPC network)301 [x] SAML metadata reachable (if SAML auth)302 [x] Lifecycle policy for retention (TIMESERIES required)303FINDINGS:304 - [INFO] Estimated monthly cost: OCU floor <N> x $0.204/hr x 720 = $<X>305 - [WARN] Standby replicas ENABLED doubles OCU cost306DEPLOY_COMMANDS:307 <ordered list of aws opensearchserverless commands>308```309310## STRICT output contract311312### Required output structure313314Every response MUST begin with this block — no preamble:315316```text317COLLECTION: <name>318VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING319TARGET: <name> (collection-id: <id> for updates)320PRE_CHECKS:321 - [PASS] <check description>322 - [FAIL] <check description> — <reason>323STEPS:324 1. CONFIRM: About to <operation> collection <name> in account <account> region <region>. This will <consequence>. Proceed? (yes/no)325 2. <exact CLI command — no placeholders>326POST_VERIFY:327 - [PASS] <verification description>328 - [FAIL] <verification description> — <reason>329TYPE: SEARCH | TIMESERIES | VECTORSEARCH330ENCRYPTION: <KMS ARN | aws-owned-key>331NETWORK: <public | VPC vpce-xxx>332OCU: <indexing> indexing + <search> search (<standby> standby)333ACCESS: <count> IAM principals334AUTH: <SAML | IAM-only>335LIFECYCLE: <retention rules | none>336NOTES: <security posture, cost estimate, capacity caveats>337```338339### FORBIDDEN output patterns340341- NEVER start with "Let me analyze…" — the VERDICT block is the FIRST line.342- NEVER use lowercase verdict values — emit `READY_TO_DEPLOY` or343 `PREREQUISITES_MISSING`.344- NEVER omit PRE_CHECKS — every pre-check must appear with `[PASS]` or345 `[FAIL]` and a specific reason.346- NEVER emit placeholder values in a READY_TO_DEPLOY plan.347- NEVER omit the CONFIRM gate as the first STEPS entry.348- NEVER claim success without verifying ACTIVE via `batch-get-collection`.349- NEVER change CLI step order — encryption first, network second, collection350 third.351- NEVER silently allow AWS-owned key for compliance workloads — flag as352 [WARN].353354### Perfect example output355356```text357COLLECTION: prod-vectors358VERDICT: READY_TO_DEPLOY359TARGET: prod-vectors360PRE_CHECKS:361 - [PASS] Collection name unique362 - [PASS] Encryption policy prod-encryption exists, references KMS abc-123363 - [PASS] KMS key abc-123 is SYMMETRIC_DEFAULT364 - [PASS] Network policy prod-network exists, covers collection/prod-*365 - [PASS] VPC subnets resolve in vpc-abc123366 - [PASS] Standby replicas ENABLED for production HA367 - [PASS] OCU floor 4 (2 indexing + 2 search)368 - [PASS] Data access policy prod-access has 3 IAM principals369 - [PASS] SAML metadata URL reachable370 - [PASS] IAM principal holds opensearchserverless:CreateCollection371STEPS:372 1. CONFIRM: About to create-collection prod-vectors in account 111111111111 region us-east-1. VECTORSEARCH with KMS, VPC, SAML, standby replicas. Estimated monthly cost: $1175 (4 OCU x 2 standby x $0.204/hr x 720). Takes 15-30 min. Proceed? (yes/no)373 2. aws opensearchserverless create-security-policy --name prod-encryption --type encryption --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"KmsKeyArn":"arn:aws:kms:us-east-1:111111111111:key/abc-123"}'374 3. aws opensearchserverless create-security-policy --name prod-network --type network --policy '{"Rules":[{"ResourceType":"collection","Resource":["collection/prod-*"]}],"SourceVPCEs":["vpce-xyz123"]}'375 4. aws opensearchserverless create-collection --name prod-vectors --type VECTORSEARCH --description "Production vector search for RAG" --standby-replicas ENABLED376 5. aws opensearchserverless create-access-policy --name prod-access --type data --policy '[{"Permission":["aoss:CreateCollectionItems","aoss:DescribeCollectionItems"],"Principal":["arn:aws:iam::111111111111:role/AppRole"]}]'377 6. aws opensearchserverless create-vpc-endpoint --name prod-vpce --vpc-id vpc-abc123 --subnet-ids subnet-aaa subnet-bbb --security-group-ids sg-abc123 --collection-endpoints <endpoint-from-step-4>378POST_VERIFY:379 - (pending execution)380 - batch-get-collection returns status=ACTIVE (wait 15-30 min)381 - get-security-policy returns prod-encryption with KMS abc-123382TYPE: VECTORSEARCH383ENCRYPTION: arn:aws:kms:us-east-1:111111111111:key/abc-123384NETWORK: VPC vpce-xyz123385OCU: 2 indexing + 2 search (standby doubles to 8 effective)386ACCESS: 3 IAM principals387AUTH: SAML via IAM Identity Center388LIFECYCLE: none (VECTORSEARCH)389NOTES:390 - KMS key is immutable post-creation.391 - Standby replicas double OCU cost ($1175/mo vs $588/mo).392 - Data access policy required — creator gets NO default access.393```394395## Verification commands (run after deployment)396> Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.397> Read it only when this section applies.398399400## Edge-case handling401> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.402> Read it only when this section applies.403404405## NEVER (top 5)4064071. **NEVER create the collection before the encryption policy.** The KMS key408 is IMMUTABLE post-creation. Without a matching encryption policy, the409 collection silently uses an AWS-owned key with no key visibility. Create410 the encryption policy FIRST, always.4114122. **NEVER create the collection before the network policy.** Without a413 matching network policy, the collection endpoint is unreachable — neither414 public nor VPC. Takes 5-15 min to propagate after creation.4154163. **NEVER omit the data access policy.** OpenSearch Serverless uses IAM417 principals via data access policies, NOT resource-based policies. The418 creator gets NO default access. Always emit `create-access-policy`.4194204. **NEVER use an asymmetric KMS key.** Requires `SYMMETRIC_DEFAULT`.421 Asymmetric keys fail with an opaque error. Verify via422 `kms describe-key --query 'KeyMetadata.KeySpec'`.4234245. **NEVER disable standby replicas for production.** Without standby, an AZ425 failure causes complete downtime. ENABLED doubles OCU cost but is required426 for HA. DISABLED is dev/staging only.427428## Expert heuristic: choosing collection type and OCU capacity429> Moved verbatim to [references/capacity-and-encryption-guide.md](references/capacity-and-encryption-guide.md) — load on demand.430> Read it only when this section applies.431432433## Recent AWS features (2024-2026)434> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.435> Read it only when this section applies.436437438## AWS documentation439440- **OpenSearch Serverless Developer Guide** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless.html441- **Encryption policies** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-encryption.html442- **Network policies** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-network.html443- **Data access policies** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-data-access.html444- **Vector search** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-vector-search.html445- **Capacity and OCU** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-capacity.html446- **SAML authentication** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-saml.html447- **CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/opensearchserverless/448449## References (load on demand)450451- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 non-obvious behaviors, edge cases, recent AWS features452- [references/diagnostic-commands.md](references/diagnostic-commands.md) — post-deployment verification commands453- [references/capacity-and-encryption-guide.md](references/capacity-and-encryption-guide.md) — collection type and OCU capacity heuristics454- [references/vector-search-guide.md](references/vector-search-guide.md) — vector search detail455## Domain456457AWS CloudOps / OpenSearch Serverless Analytics & Vector Search Provisioning.