generative-ai-cdk-constructs

awslabsApache-2.0活跃维护

基于 AWS CDK 的生成式 AI 基础设施构件库,把 Bedrock、知识库、Agent 等常见模式封装成可复用构造,省去手写云资源编排。

AWS Generative AI CDK Constructs are sample implementations of AWS CDK for common generative AI patterns.

v0.1.320发布于 2026-09-01 23:59 UTC543star77fork同步于 2026-11-10 17:58 UTC

怎么上手

由 README 提炼,执行前请确认
npm install @cdklabs/generative-ai-cdk-constructs
pip install cdklabs.generative-ai-cdk-constructs
硬件要求按 README 说明

README 未说明;构造部署的是 AWS 云上资源(SageMaker 端点、Bedrock、OpenSearch Serverless 等),本地只需能运行 AWS CDK 应用的环境

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

AWS CDK 的生成式 AI 模式库,用预置构造快速搭建可复用的 Bedrock、SageMaker 等基础设施

基于 AWS CDK 的生成式 AI 基础设施构件库,把 Bedrock、知识库、Agent 等常见模式封装成可复用构造,省去手写云资源编排。

核心能力

  • 提供多服务、架构良好的 L3 模式构造
  • 覆盖 SageMaker JumpStart、Hugging Face 与自定义模型部署
  • 提供 Bedrock 监控仪表盘与批量推理 Step Functions 模式
  • 提供 OpenSearch Serverless 向量集合与向量索引 L2 构造
  • 支持 TypeScript、Python、Java、.NET、Go 多语言包

容易踩的坑

所有类均为 Experimental,升级版本可能带来不向后兼容的改动;Bedrock L2 构造已弃用,需迁移到 @aws-cdk/aws-bedrock-alpha;构造库与 AWS CDK 独立发版,需按 CHANGELOG 确认所用 CDK 版本不低于对应版本

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.1.320
  1. v0.1.320最新正式版2026-09-01 · 2026-09-01 23:59 UTC

    0.1.320 (2026-09-01)

    Bug Fixes

    • build: exclude validation-report.json from integ snapshots (a4dda8c)
  2. v0.1.3192026-09-01 · 2026-09-01 21:35 UTC
    查看更新说明

    0.1.319 (2026-09-01)

    Bug Fixes

    • deps: remediate open Dependabot security alerts (#1387) (f1c7eb0)
  3. v0.1.3182026-07-10 · 2026-07-10 02:44 UTC
    查看更新说明

    0.1.318 (2026-07-08)

    Features

    • custom-resources: remove Docker build dependency from build phase (9f08734), closes #567

    Bug Fixes

    • bedrock: grant delete vectors permission to knowledge base execution role (#1306) (79451df), closes #1305
    • s3vectors: return Grant covering all index ARNs in _internalGrant (#1358) (c816f6c)
  4. v0.1.3172026-05-15 · 2026-05-15 19:16 UTC
    查看更新说明

    0.1.317 (2026-05-15)

    Features

    What's Changed

    New Contributors

    Full Changelog: https://github.com/awslabs/generative-ai-cdk-constructs/compare/v0.1.316...v0.1.317

  5. v0.1.3162026-03-19 · 2026-03-19 19:17 UTC
    查看更新说明

    0.1.316 (2026-03-19)

    Bug Fixes

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    AWS Generative AI CDK Constructs

    Stability: Experimental

    All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


    View on Construct Hub

    PyPI version npm version NuGet Version Maven Central Version Go Version

    Terraform Amazon Bedrock Module Terraform Amazon OpenSearch Serverless Module Terraform Amazon SageMaker Endpoint Module Terraform Streamlit Module

    Table of contents

    Introduction

    The AWS Generative AI Constructs Library is an open-source extension of the AWS Cloud Development Kit (AWS CDK) that provides multi-service, well-architected patterns for quickly defining solutions in code to create predictable and repeatable infrastructure, called constructs. The goal of AWS Generative AI CDK Constructs is to help developers build generative AI solutions using pattern-based definitions for their architecture.

    The patterns defined in AWS Generative AI CDK Constructs are high level, multi-service abstractions of AWS CDK constructs that have default configurations based on well-architected best practices. The library is organized into logical modules using object-oriented techniques to create each architectural pattern model.

    CDK Versions

    AWS Generative AI CDK Constructs and the AWS CDK are independent teams and have different release schedules. Each release of AWS Generative AI CDK Constructs is built against a specific version of the AWS CDK. The CHANGELOG.md file lists the CDK version associated with each AWS Generative AI Constructs release. For instance, AWS Generative AI CDK Constructs v0.0.0 was built against AWS CDK v2.96.2. This means that to use AWS Generative AI CDK Constructs v0.0.0, your application must include AWS CDK v2.96.2 or later. You can continue to use the latest AWS CDK versions and upgrade the your AWS Generative AI CDK Constructs version when new releases become available.

    Contributing

    Contributions of all kinds are welcome! Check out our contributor guide

    Design guidelines and Development guide

    If you want to add a new construct to the library, check out our design guidelines, then follow the development guide

    Getting Started

    • Create or use an existing CDK application in TypeScript.
      • cdk init app --language typescript
    • Run npm install @cdklabs/generative-ai-cdk-constructs
    • The package should be added to your package.json.
    • Import the library:
      • import * as genai from '@cdklabs/generative-ai-cdk-constructs';
    • Create or use an existing CDK application in Python
      • cdk init app --language python
    • Install the package:
      • pip install cdklabs.generative-ai-cdk-constructs
    • Import the library:
      • import cdklabs.generative_ai_cdk_constructs
    • Create or use an existing CDK application in Python
      • cdk init app --language csharp
    • Install the package while in the Visual Studio project:
      • dotnet add package CdkLabs.GenerativeAICdkConstructs
    • Use the namespace:
      • using Cdklabs.GenerativeAiCdkConstructs;
    • Create or use an existing CDK application in Python
      • cdk init app --language go
    • Get the module:
      • go get github.com/cdklabs/generative-ai-cdk-constructs-go/generativeaicdkconstructs
    • Import the library:
      • import "github.com/cdklabs/generative-ai-cdk-constructs-go/generativeaicdkconstructs"

    NOTE: The Go distribution repository, distributes the JSII tar gzipped versioned source from the source repository

    • Create or use an existing CDK application in Java
      • cdk init app --language java
    • Add the dependency into the pom.xml
    <dependency>
        <groupId>io.github.cdklabs</groupId>
        <artifactId>generative-ai-cdk-constructs</artifactId>
        <version>Get the latest version and insert it here</version>
    </dependency>
    

    Refer to the documentation for additional guidance on a particular construct: Catalog

    Catalog

    The following constructs are available in the library:

    L3 constructs

    ConstructDescriptionAWS Services used
    SageMaker model deployment (JumpStart)Deploy a foundation model from Amazon SageMaker JumpStart to an Amazon SageMaker endpoint.Amazon SageMaker
    SageMaker model deployment (Hugging Face)Deploy a foundation model from Hugging Face to an Amazon SageMaker endpoint.Amazon SageMaker
    SageMaker model deployment (Custom)Deploy a foundation model from an S3 location to an Amazon SageMaker endpoint.Amazon SageMaker
    Amazon Bedrock Monitoring (Amazon CloudWatch Dashboard)Amazon CloudWatch dashboard to monitor model usage from Amazon Bedrock.Amazon CloudWatch
    Bedrock Data AutomationUse Amazon bedrock data automation client to to build and manage intelligent document processing, media analysis, and other multimodal data-centric automation solutionsAWS Lambda, Amazon S3 bucket
    Bedrock Batch Step FunctionsManage Bedrock model invocation jobs(batch inference) in AWS Step Functions state machinesAWS Step Functions, AWS Lambda, AWS EventBridge, Amazon Bedrock, AWS IAM

    L2 Constructs

    [!WARNING] Important: Amazon Bedrock L2 constructs are transitioning to the AWS CDK core repository. You can now find these constructs at: https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-bedrock-alpha. Please migrate to the alpha package, as Bedrock L2 constructs in this repository are now deprecated and will no longer receive updates.

    ConstructDescriptionAWS Services used
    Amazon BedrockCDK L2 Constructs for Amazon Bedrock.Amazon Bedrock, Amazon OpenSearch Serverless, AWS Lambda
    Amazon OpenSearch Serverless Vector CollectionCDK L2 Constructs to create a vector collection.Amazon OpenSearch Vector Index
    Amazon OpenSearch Vector IndexCDK L1 Custom Resource to create a vector index.Amazon OpenSearch Serverless, AWS Lambda
    Amazon Aurora DSQLCDK L2 Constructs for Amazon Aurora DSQL.Amazon Aurora DSQL
    Amazon S3 VectorsCDK L2 Constructs for Amazon S3 vectors.Amazon S3 Vectors

    Sample Use Cases

    The official samples repository includes a collection of functional use case implementations to demonstrate the usage of AWS Generative AI CDK Constructs. These can be used in the same way as architectural patterns, and can be conceptualized as an additional "higher-level" abstraction of those patterns. Those patterns (constructs) are composed together into stacks, forming a "CDK app".

    Additional Resources

    ResourceTypeDescription
    AWS re:Invent 2023 - Keynote with Dr. Werner VogelsKeynoteDr. Werner Vogels, Amazon.com's VP and CTO, announces the AWS Generative AI CDK Constructs during his AWS re:Invent 2023 keynote.
    Workshop - Building Generative AI Apps on AWS with CDKWorkshopIn this workshop, you will explore how to build a sample generative AI app on AWS using CDK and Generative AI CDK Constructs.
    Workshop - Hands on AWS CDK Generative AI ConstructsWorkshopIn this workshop you will deploy projects that use CDK constructs from this library. Projects are from the amazon-bedrock-samples Github Repository.
    Build generative AI applications with Amazon Titan Text Premier, Amazon Bedrock, and AWS CDKBlog post + Code sampleBlog post exploring building and deploying two sample applications powered by Amazon Titan Text Premier using the Generative AI CDK constructs.
    aws-cdk-stack-builder-toolCode sampleAWS CDK Builder is a browser-based tool designed to streamline bootstrapping of Infrastructure as Code (IaC) projects using the AWS Cloud Development Kit (CDK).
    CDK Live! Building generative AI applications and architectures leveraging AWS CDK Constructs!VideoCDK Live! episode focused on building and deploying generative AI applications and architectures on AWS using the AWS Cloud Development Kit (CDK) and the AWS Generative AI CDK Constructs.
    Announcing AWS Generative AI CDK Constructs!Blog postBlog post announcing the release of the AWS Generative AI CDK Constructs.
    Streamline insurance underwriting with generative AI using Amazon BedrockBlog post + Code sampleBlog post and code sample discussing how to use AWS generative artificial intelligence (AI) solutions like Amazon Bedrock to improve the underwriting process, including rule validation, underwriting guidelines adherence, and decision justification.
    aws-genai-llm-chatbotCode sampleMulti-Model and Multi-RAG Powered Chatbot Using AWS CDK on AWS allowing you to experiment with a variety of Large Language Models and Multimodal Language Models, settings and prompts in your own AWS account.
    bedrock-claude-chatCode sampleAWS-native chatbot using Bedrock + Claude (+Mistral).
    amazon-bedrock-ragCode sampleFully managed RAG solution using Knowledge Bases for Amazon Bedrock.
    Amazon Bedrock Multimodal SearchCode sampleMultimodal product search app built using Amazon Titan Multimodal Embeddings model.
    Amazon Bedrock Knowledge Bases with Private DataBlog post + Code sampleBlog post and associated code sample demonstrating how to integrate Knowledge Bases into Amazon Bedrock to provide foundational models with contextual data from private data sources.
    Automating tasks using Amazon Bedrock Agents and AIBlog post + Code sampleBlog post and associated code sample demonstrating how to deploy an Amazon Bedrock Agent and a Knowledge Base through a hotel and spa use case.
    Agents for Amazon Bedrock - Powertools for AWS Lambda (Python)Code sampleCreate Agents for Amazon Bedrock using event handlers and auto generation of OpenAPI schemas.
    Text to SQL Bedrock AgentCode sampleHarnessing the power of natural language processing, the "Text to SQL Bedrock Agent" facilitates the automatic transformation of natural language questions into executable SQL queries.
    Dynamic Text-to-SQL for Enterprise Workloads with Amazon Bedrock AgentCode sampleElevate your data analysis with an end-to-end agentic Text-to-SQL solution, built on AWS for enterprise-scale adaptability and resilience. Ideal for complex scenarios like fraud detection in financial services.

    Contributors

    contributors

    Operational Metrics Collection

    Generative AI CDK Constructs may collect anonymous operational metrics, including: the region a construct is deployed, the name and version of the construct deployed, and related information. We may use the metrics to maintain, provide, develop, and improve the constructs and AWS services.

    Roadmap

    Roadmap is available through the GitHub Project

    Deprecation

    To understand our deprecation process, please refer to the dedicated documentation

    License

    Apache-2.0

    Legal Disclaimer

    You should consider doing your own independent assessment before using the content in this library for production purposes. This may include (amongst other things) testing, securing, and optimizing the CDK constructs and other content, provided in this library, based on your specific quality control practices and standards.


    © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.