Retrieval augmented generation on AWS
an ingestion lane (S3, Lambda) and a query lane (Cognito, API Gateway, a Bedrock AgentCore agent) meet at shared services: a Titan Text Embeddings V2 model that embeds both the chunks and the question, a Bedrock text model, and an OpenSearch Serverless vector index.
aws10 nodes4 groups11 edges
aws-genai-rag.yamlOn GitHub
# yaml-language-server: $schema=../references/diagram.schema.json
title: Retrieval augmented generation on AWS
subtitle: Documents are chunked and embedded into OpenSearch Serverless; an AgentCore agent retrieves context and answers with a Bedrock model
direction: down
# merge: false gives every edge into the models, the vector index and CloudWatch its own port;
# merged trunks would hide which flow is which.
layout: { merge: false }
legend:
solid: Requests and data
dashed: Authentication
dotted: Telemetry
groups:
cloud: { type: aws:cloud }
region: { type: aws:region, label: us-east-1, in: cloud }
# Two lanes so the flows do not interleave; both models and the vector index sit outside them, where the flows meet.
query: { type: zone, label: Query, in: region }
ingestion: { type: zone, label: Ingestion, in: region }
nodes:
users: { icon: aws:users, label: Users }
auth: { icon: aws:cognito, label: Amazon Cognito, note: User pool, in: query }
api: { icon: aws:api-gateway, label: Amazon API Gateway, in: query }
agent: { icon: aws:bedrock-agentcore, label: RAG agent, note: Amazon Bedrock AgentCore Runtime, in: query }
llm: { icon: aws:bedrock, label: Amazon Bedrock, note: Text generation model, in: region }
docs: { icon: aws:simple-storage-service-bucket, label: Documents, note: Amazon S3 bucket, in: ingestion }
ingest: { icon: aws:lambda-lambda-function, label: Ingestion function, note: Chunk and embed, in: ingestion }
embed: { icon: aws:bedrock, label: Amazon Bedrock, note: Titan Text Embeddings V2, in: region }
vectors: { icon: aws:opensearch-service-index, label: Vector index, note: Amazon OpenSearch Serverless, in: region }
logs: { icon: aws:cloudwatch, label: Amazon CloudWatch, note: Logs and traces, in: region }
edges:
- users --> auth: sign in
- users -> api: question
- { from: auth, to: api, arrow: start, line: dashed, label: verify token }
- api -> agent
- agent -> llm: prompt and context
- agent -> embed: embed question
- agent -> vectors: retrieve
- docs -> ingest: ObjectCreated
- ingest -> embed: chunks
- ingest -> vectors: index
- agent, ingest ..> logsStart from this one
Copies the spec to diagram.yaml, then renders every format.
$ orrery init aws-genai-rag$ orrery render diagram.yaml -f all --theme both