← AWS Data AnalyticsCONTENT HISTORYWHAT CHANGED · RULE-BASED ANALYSIS
Update to AWS Data Analytics
Snapshot Sep 30, 2026 · 22:53 UTC · version 1.0.0
Collection source: not recorded for this historical snapshot.
First saved snapshot
No earlier snapshot is available to establish a change.
Compare saved observations
Download comparison JSONFull technical diff · 0 changed fields
Full snapshot data
{
"name": "storing-and-querying-vectors",
"description": "Store and query vector embeddings using Amazon S3 Vectors, a cost-effective long-term vector storage service with its own API namespace (s3vectors). Triggers on: create S3 vector bucket, vector index, store embeddings, semantic search, RAG vector storage, similarity search, vector database, migrate from other vector databases. Do NOT use for: querying tabular data (use querying-data-lake), S3 object storage, or hundreds/thousands of sustained QPS (use OpenSearch).",
"included_files": [
{
"relative_path": "references/limits-and-patterns.md",
"size_in_bytes": 2734
},
{
"relative_path": "references/metadata-filtering.md",
"size_in_bytes": 2186
}
],
"skill_md_contents": "---\nname: storing-and-querying-vectors\ndescription: >-\n Store and query vector embeddings using Amazon S3 Vectors, a cost-effective long-term\n vector storage service with its own API namespace (s3vectors). Triggers on: create\n S3 vector bucket, vector index, store embeddings, semantic search, RAG vector storage,\n similarity search, vector database, migrate from other vector databases. Do NOT\n use for: querying tabular data (use querying-data-lake), S3 object storage, or hundreds/thousands\n of sustained QPS (use OpenSearch).\nmetadata:\n version: \"1\"\n---\n\n# Store and Query Vectors with Amazon S3 Vectors\n\n## Overview\n\nAmazon S3 Vectors is a cost-effective AWS service for storing and querying vector embeddings at scale. Optimized for long-term storage with subsecond latency for cold queries, as low as 100ms for warm queries.\n\n## Decision Guide\n\n- **Hundreds/thousands of sustained queries per second (QPS)**: Wrong tool. Recommend OpenSearch.\n- **Hybrid search, aggregations, faceted search**: Recommend OpenSearch with S3 Vectors as storage engine. For OpenSearch integration, search AWS docs for `\"Using S3 Vectors with OpenSearch Service\"`.\n- **Tiered (bulk + hot)**: S3 Vectors for storage + OpenSearch Serverless for real-time. See `references/limits-and-patterns.md`.\n- **Cost-effective storage, infrequent queries, RAG**: S3 Vectors is the right fit. Proceed.\n\nFor latest guidance, search AWS docs for `\"S3 Vectors best practices\"`.\n\n## Common Tasks\n\nClassify the request before starting:\n\n- **Simple query**: Existing index, skip to Step 6\n- **Standard**: You MUST list existing indexes first and suggest reusing if relevant. Else, new index + store vectors, follow Steps 2-6\n- **Migration or multi-tenant**: Read `references/limits-and-patterns.md` first, then Steps 2-6\n\nYou MUST execute commands using AWS MCP server tools when connected. Fall back to AWS CLI only if AWS MCP is unavailable. You MUST explain each step to the user before executing.\n\n### 1. Verify Dependencies\n\n**Constraints:**\n\n- You MUST check whether AWS MCP tools or AWS CLI is available and inform user if missing\n- You MUST confirm target AWS region\n\n### 2. Create a Vector Bucket\n\nYou MUST confirm bucket name with user. Names: 3-63 chars, lowercase letters, numbers, hyphens only. Encryption (SSE-S3 default or SSE-KMS for compliance) is immutable after creation.\n\n```bash\naws s3vectors create-vector-bucket \\\n --vector-bucket-name <BUCKET_NAME>\n```\n\n**Constraints:**\n\n- You MUST explain encryption cannot be changed after creation\n- For SSE-KMS, KMS key policy MUST grant `kms:GenerateDataKey` and `kms:Decrypt` to the S3 Vectors service principal `indexing.s3vectors.amazonaws.com`. You MUST use full KMS key ARN (not alias). See `references/limits-and-patterns.md` for command example.\n\n### 3. Create a Vector Index\n\nEvery parameter is **immutable after creation**.\n\n**Pre-flight checklist (confirm ALL with user):**\n\n1. **Dimension** (required, integer 1-4096) -- MUST match embedding model output\n2. **Distance metric** (required) -- `cosine` or `euclidean`. Use embedding model's recommended metric;\n3. **Non-filterable metadata keys** (optional, max 10, 1-63 chars) -- Declare at creation or lose forever. For Bedrock Knowledge Bases integration, search AWS docs for `\"S3 Vectors Bedrock Knowledge Bases prerequisites\"` to get the required key names.\n4. **Encryption** (optional) -- Inherits from bucket. Override per-index if needed.\n\n```bash\naws s3vectors create-index \\\n --vector-bucket-name <BUCKET_NAME> \\\n --index-name <INDEX_NAME> \\\n --dimension <DIM> \\\n --distance-metric <cosine|euclidean> \\\n --data-type float32 \\\n --metadata-configuration '{\"nonFilterableMetadataKeys\":[\"<KEY1>\",\"<KEY2>\"]}'\n```\n\nOmit `--metadata-configuration` if no non-filterable keys are needed.\n\nIndex names: 3-63 chars, lowercase, numbers, hyphens, dots. Unique within bucket. Filterable metadata: 2 KB limit. Total metadata (filterable + non-filterable combined): 40 KB. See `references/metadata-filtering.md`.\n\n### 4. Generate Embeddings (if needed)\n\nSkip to Step 5 (store) or Step 6 (query) if user already has embeddings.\n\n**Constraints:**\n\n- You MUST ask which embedding model to use if not specified\n- You MUST NOT assume a default model\n- Dimension MUST match Step 3\n- You MUST use the same model for both storing and querying\n\nGenerate embeddings with Bedrock invoke-model:\n\n```bash\naws bedrock-runtime invoke-model \\\n --model-id <MODEL_ID> \\\n --content-type application/json \\\n --cli-binary-format raw-in-base64-out \\\n --body '{\"inputText\": \"your text\"}' \\\n invoke-model-output.json\n```\n\nYou MUST use `--cli-binary-format raw-in-base64-out` for CLI v2. Output file is required for CLI. The response key is model-dependent (e.g., embedding for Titan, embeddings for Cohere). For Titan, parse with `json.load(open('invoke-model-output.json'))['embedding']`. Use `embedding` array as `float32` in put-vectors or query-vectors. For batch embedding generation, use AWS SDK or CLI.\n\n### 5. Put Vectors\n\n```bash\naws s3vectors put-vectors \\\n --vector-bucket-name <BUCKET_NAME> \\\n --index-name <INDEX_NAME> \\\n --vectors '[{\"key\":\"<ID>\",\"data\":{\"float32\":[<EMBEDDING>]},\"metadata\":{\"topic\":\"science\"}}]'\n```\n\n**Constraints:**\n\n- You MUST NOT exceed 500 vectors per call\n- You SHOULD batch vectors for cost optimization\n- For bulk operations, You SHOULD use an SDK instead of CLI -- vector payloads may be too large for shell arguments\n- You MUST implement retry with backoff on `429 TooManyRequestsException`\n- See `references/limits-and-patterns.md` for batch patterns\n\n### 6. Query Vectors\n\nGenerate embedding if needed (Step 4), then query:\n\n```bash\naws s3vectors query-vectors \\\n --vector-bucket-name <BUCKET_NAME> \\\n --index-name <INDEX_NAME> \\\n --query-vector '{\"float32\":[<EMBEDDING>]}' \\\n --top-k 10 \\\n --return-distance\n```\n\nOptional: add `--return-metadata` and/or `--filter '{\"topic\":{\"$eq\":\"science\"}}'` (both require GetVectors permission). See `references/metadata-filtering.md`.\n\nExample response body: `{\"vectors\": [{\"key\": \"id1\", \"distance\": 0.45, \"metadata\": {\"topic\": \"science\"}}, ...], \"distanceMetric\": \"cosine\"}`\n\n**Constraints:**\n\n- Using `--filter` or `--return-metadata` requires both `s3vectors:QueryVectors` AND `s3vectors:GetVectors` IAM permissions. Without GetVectors, these options return 403.\n\n## Troubleshooting\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| `DimensionMismatch` | Dims don't match index | Use matching model, or delete/recreate index (confirm with user -- destroys all vectors). |\n| `403 Forbidden` with `--filter` or `--return-metadata` | Missing `s3vectors:GetVectors` | Add `s3vectors:GetVectors` to IAM policy. |\n| Fewer results than `--top-k` | Few vectors match filter | Expected -- filtering is inline. Broaden filter. |\n| `429 TooManyRequestsException` | Exceeded per-index rate limits | Retry with backoff. Shard across indexes for sustained throughput. Search AWS docs for `\"S3 Vectors limitations and restrictions\"` for current limits. |\n| `AccessDeniedException` | Missing `s3vectors:*` IAM actions | S3 Vectors uses `s3vectors:*` namespace, not `s3:*`. Update IAM policy. |\n| `RequestTimeoutException` or service unavailable | Request timeout or region not supported | Retry request. For regional availability, search AWS docs for `\"S3 Vectors limitations and restrictions\"`. |\n\n## Additional Resources\n\n- [limits-and-patterns.md](references/limits-and-patterns.md) -- Multi-tenant patterns, batch ingestion, SSE-KMS, migration\n- [metadata-filtering.md](references/metadata-filtering.md) -- Filter operators, non-filterable metadata, Bedrock KB keys\n"
}SHA-256: d61df6fee703146614ba55abe0cc976f4c652d231a4e4172ec748e706c7e43cd