Skip to content
v2.278.0

Amazon Bedrock Construct Library ​

Amazon Bedrock is a fully managed service that offers a choice of foundation models (FMs) along with a broad set of capabilities for building generative AI applications.

This construct library provides a collection of constructs that can look up existing Bedrock models for use with other services' CDK constructs, such as AWS Step Functions.

To look up a Bedrock base foundation model:

ts
import * as bedrock from 'aws-cdk-lib/aws-bedrock';

bedrock.FoundationModel.fromFoundationModelId(
  this,
  'Model',
  bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_V2,
);
python
import aws_cdk.aws_bedrock as bedrock


bedrock.FoundationModel.from_foundation_model_id(self, "Model", bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_V2)
java
import software.amazon.awscdk.services.bedrock.*;


FoundationModel.fromFoundationModelId(this, "Model", FoundationModelIdentifier.ANTHROPIC_CLAUDE_V2);
csharp
using Amazon.CDK.AWS.Bedrock;


FoundationModel.FromFoundationModelId(this, "Model", FoundationModelIdentifier.ANTHROPIC_CLAUDE_V2);
go
import "github.com/aws/aws-cdk-go/awscdk"


bedrock.FoundationModel_FromFoundationModelId(this, jsii.String("Model"), bedrock.FoundationModelIdentifier_ANTHROPIC_CLAUDE_V2())

To look up a Bedrock provisioned throughput model:

ts
import * as bedrock from 'aws-cdk-lib/aws-bedrock';

bedrock.ProvisionedModel.fromProvisionedModelArn(
  this,
  'Model',
  'arn:aws:bedrock:us-east-2:123456789012:provisioned-model/abc-123',
);
python
import aws_cdk.aws_bedrock as bedrock


bedrock.ProvisionedModel.from_provisioned_model_arn(self, "Model", "arn:aws:bedrock:us-east-2:123456789012:provisioned-model/abc-123")
java
import software.amazon.awscdk.services.bedrock.*;


ProvisionedModel.fromProvisionedModelArn(this, "Model", "arn:aws:bedrock:us-east-2:123456789012:provisioned-model/abc-123");
csharp
using Amazon.CDK.AWS.Bedrock;


ProvisionedModel.FromProvisionedModelArn(this, "Model", "arn:aws:bedrock:us-east-2:123456789012:provisioned-model/abc-123");
go
import bedrock "github.com/aws/aws-cdk-go/awscdk"


bedrock.ProvisionedModel_FromProvisionedModelArn(this, jsii.String("Model"), jsii.String("arn:aws:bedrock:us-east-2:123456789012:provisioned-model/abc-123"))

L2 constructs for this service are available in the @aws-cdk/aws-bedrock-alpha package.

You can also use the automatically generated L1 constructs, in the same way you would use the CloudFormation AWS::Bedrock resources directly.

Types ​

Constructs (L1) ​

  • CfnAgent Construct (L1)
    Specifies an agent as a resource in a top-level template. Minimally, you must specify the following properties:.
  • CfnAgentAlias Construct (L1)
    Specifies an agent alias as a resource in a top-level template. Minimally, you must specify the following properties:.
  • CfnApplicationInferenceProfile Construct (L1)
    Specifies an inference profile as a resource in a top-level template.
  • CfnAutomatedReasoningPolicy Construct (L1)
    Creates an Automated Reasoning policy for Amazon Bedrock Guardrails.
  • CfnAutomatedReasoningPolicyVersion Construct (L1)
    Creates a new version of an existing Automated Reasoning policy.
  • CfnBlueprint Construct (L1)
    Details about a data automation blueprint.
  • CfnDataAutomationLibrary Construct (L1)
    Resource Type definition for AWS::Bedrock::DataAutomationLibrary.
  • CfnDataAutomationProject Construct (L1)
    A data automation project.
  • CfnDataSource Construct (L1)
    > Properties with __Update requires: Replacement__ can result in the creation of a new data source and deletion of the old one.
  • CfnEnforcedGuardrailConfiguration Construct (L1)
    Definition of AWS::Bedrock::EnforcedGuardrailConfiguration Resource Type.
  • CfnFlow Construct (L1)
    Creates a prompt flow that you can use to send an input through various steps to yield an output.
  • CfnFlowAlias Construct (L1)
    Creates an alias of a flow for deployment.
  • CfnFlowVersion Construct (L1)
    Creates a version of the flow that you can deploy.
  • CfnGuardrail Construct (L1)
    Creates a guardrail to detect and filter harmful content in your generative AI application.
  • CfnGuardrailVersion Construct (L1)
    Creates a version of the guardrail.
  • CfnIntelligentPromptRouter Construct (L1)
    Specifies an intelligent prompt router resource for Amazon Bedrock .
  • CfnKnowledgeBase Construct (L1)
    Specifies a knowledge base as a resource in a top-level template. Minimally, you must specify the following properties:.
  • CfnKnowledgeBasePolicy Construct (L1)
    Definition of AWS::Bedrock::KnowledgeBasePolicy Resource Type.
  • CfnPrompt Construct (L1)
    Creates a prompt in your prompt library that you can add to a flow.
  • CfnPromptVersion Construct (L1)
    Creates a static snapshot of your prompt that can be deployed to production.
  • CfnResourcePolicy Construct (L1)
    Definition of AWS::Bedrock::ResourcePolicy Resource Type.
  • CfnRetrievalInstruction Construct (L1)
    Resource Type definition for AWS::Bedrock::RetrievalInstruction.
  • CfnSession Construct (L1)
    Definition of AWS::Bedrock::Session Resource Type.

Structs ​

Classes ​

Interfaces ​

  • IModel Interface
    Represents a Bedrock model.