| 23 | import * as origins from "aws-cdk-lib/aws-cloudfront-origins" |
| 24 | import * as apigw from "aws-cdk-lib/aws-apigatewayv2" |
| 25 | import { HttpLambdaIntegration } from "aws-cdk-lib/aws-apigatewayv2-integrations" |
| 26 | import { HttpJwtAuthorizer } from "aws-cdk-lib/aws-apigatewayv2-authorizers" |
| 27 | |
| 28 | // The AgentCore web-search connector is only available in these Regions today. |
| 29 | const WEB_SEARCH_REGIONS = ["us-east-1", "eu-west-1", "ap-northeast-1"] |
| 30 | |
| 31 | class DevGeniusStack extends cdk.Stack { |
| 32 | constructor(scope: Construct, id: string, props: cdk.StackProps) { |
| 33 | super(scope, id, props) |
| 34 | |
| 35 | const stackName = cdk.Stack.of(this).stackName |
| 36 | const region = cdk.Stack.of(this).region |
| 37 | const account = cdk.Stack.of(this).account |
| 38 | |
| 39 | // Default model can be overridden with `-c modelId=...`. |
| 40 | const modelId = |
| 41 | this.node.tryGetContext("modelId") || "us.anthropic.claude-sonnet-4-6" |
| 42 | |
| 43 | // ----------------------------------------------------------------- // |
| 44 | // Data stores |
| 45 | // ----------------------------------------------------------------- // |
| 46 | const conversationTable = new dynamodb.TableV2(this, "ConversationTable", { |
| 47 | tableName: `${stackName}-conversation-table`, |
| 48 | partitionKey: { name: "conversation_id", type: dynamodb.AttributeType.STRING }, |
| 49 | sortKey: { name: "uuid", type: dynamodb.AttributeType.STRING }, |
| 50 | billing: dynamodb.Billing.onDemand(), |
| 51 | encryption: dynamodb.TableEncryptionV2.dynamoOwnedKey(), |
| 52 | removalPolicy: cdk.RemovalPolicy.DESTROY, |
| 53 | }) |
| 54 | |
| 55 | const feedbackTable = new dynamodb.TableV2(this, "FeedbackTable", { |
| 56 | tableName: `${stackName}-feedback-table`, |
| 57 | partitionKey: { name: "conversation_id", type: dynamodb.AttributeType.STRING }, |
| 58 | sortKey: { name: "uuid", type: dynamodb.AttributeType.STRING }, |
| 59 | billing: dynamodb.Billing.onDemand(), |
| 60 | encryption: dynamodb.TableEncryptionV2.dynamoOwnedKey(), |
| 61 | removalPolicy: cdk.RemovalPolicy.DESTROY, |
| 62 | }) |
| 63 | |
| 64 | const sessionTable = new dynamodb.TableV2(this, "SessionTable", { |
| 65 | tableName: `${stackName}-session-table`, |
| 66 | partitionKey: { name: "conversation_id", type: dynamodb.AttributeType.STRING }, |
| 67 | // Lists a user's conversations for the sidebar, newest first. |
| 68 | globalSecondaryIndexes: [ |
| 69 | { |
| 70 | indexName: "by-user", |
| 71 | partitionKey: { name: "user_email", type: dynamodb.AttributeType.STRING }, |
| 72 | sortKey: { name: "updated", type: dynamodb.AttributeType.STRING }, |
| 73 | }, |
| 74 | ], |
| 75 | billing: dynamodb.Billing.onDemand(), |
| 76 | encryption: dynamodb.TableEncryptionV2.dynamoOwnedKey(), |
| 77 | removalPolicy: cdk.RemovalPolicy.DESTROY, |
| 78 | }) |
| 79 | |
| 80 | // Tracks async chat/generate jobs (the client polls these). TTL cleans up. |
| 81 | const jobsTable = new dynamodb.TableV2(this, "JobsTable", { |
| 82 | tableName: `${stackName}-jobs-table`, |
nothing calls this directly
no outgoing calls
no test coverage detected