aws / aws/aws-cdk

Bedrock: CDK / Cloudformation no support for Datasource / KnowledgeBase in Stockholm region eu-north-1

Open
#34,062 4 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudformation bug p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

I can synth the stack in Stockholm region (eu-north-1) but when I deploy it I get the following:
ValidationError: Template format error: Unrecognized resource types: [AWS::Bedrock::DataSource, AWS::Bedrock::KnowledgeBase].

I can deploy the stack in eu-west-1, looks like the issue https://github.com/aws/aws-cdk/issues/29966 But it did not get fixed when bedrock got available in Stockholm (eu-north-1).

I'm using the latest cdk version 2.118.0 for java/kotlin. implementation("software.amazon.awscdk:aws-cdk-lib:2.188.0").

Is there a solution for this now? Or do I have to wait until another update?

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

2.118.0

### Expected Behavior

Expected to be able to deploy the cdk/cloudformation stack as in eu-west-1 (Irland)

### Current Behavior

Not able to deploy a cdk/cloudfromation stack in eu-north-1 that contains [AWS::Bedrock::DataSource, AWS::Bedrock::KnowledgeBase]

### Reproduction Steps

This code will fail on the storage configuration but it gets deployed beyond cdk synth in eu-north-1.
import software.amazon.awscdk.RemovalPolicy
import software.amazon.awscdk.Stack
import software.amazon.awscdk.StackProps
import software.amazon.awscdk.services.bedrock.CfnDataSource
import software.amazon.awscdk.services.bedrock.CfnKnowledgeBase
import software.amazon.awscdk.services.iam.ManagedPolicy
import software.amazon.awscdk.services.iam.Role
import software.amazon.awscdk.services.iam.RoleProps
import software.amazon.awscdk.services.iam.ServicePrincipal

import software.amazon.awscdk.services.s3.Bucket
import software.constructs.Construct

class BedrockKnowledgeBaseStack(scope: Construct, id: String, props: StackProps? = null) : Stack(scope, id, props) {
init {

// Create a new S3 bucket
val s3Bucket = Bucket.Builder.create(this, "Destroy")
.removalPolicy(RemovalPolicy.DESTROY)
.autoDeleteObjects(true)
.build()

// Create an IAM Role for Bedrock to access other AWS resources
val bedrockRole = Role(this, "BedrockRole", RoleProps.builder()
.assumedBy(ServicePrincipal("bedrock.amazonaws.com"))
.managedPolicies(listOf(
ManagedPolicy.fromAwsManagedPolicyName("AmazonBedrockFullAccess"),
ManagedPolicy.fromAwsManagedPolicyName("AmazonS3ReadOnlyAccess")
))
.build())

// Create a Bedrock Knowledge Base
val knowledgeBase = CfnKnowledgeBase.Builder.create(this, "MyKnowledgeBase")
.name("MyBedrockKnowledgeBase")
.roleArn(bedrockRole.roleArn)
.knowledgeBaseConfiguration(
CfnKnowledgeBase.KnowledgeBaseConfigurationProperty.builder()
.type("VECTOR")
.vectorKnowledgeBaseConfiguration(
CfnKnowledgeBase.VectorKnowledgeBaseConfigurationProperty.builder()
.embeddingModelArn("arn:aws:bedrock:${this.region}::foundation-model/amazon.titan-embed-text-v2")
.build()
)
.build()
)
.build()

// Create the S3 DataSource for Bedrock KnowledgeBase
val dataSource = CfnDataSource.Builder.create(this, "MyS3DataSource")
.knowledgeBaseId(knowledgeBase.attrKnowledgeBaseId)
.name("S3DataSource")
.dataSourceConfiguration(
CfnDataSource.DataSourceConfigurationProperty.builder()
.type("S3")
.s3Configuration(
CfnDataSource.S3DataSourceConfigurationProperty.builder()
.bucketArn(s3Bucket.bucketArn)
.build()
)
.build()
)
.build()

// Grant Bedrock access to the S3 bucket
s3Bucket.grantRead(bedrockRole)

}
}

### Possible Solution

Add the missing support to Stockholm eu-north-1 as you have in the other regions that have Bedrock support like eu-west-1 Irland.

### Additional Information/Context

_No response_

### CDK CLI Version

2.1005.0

### Framework Version

_No response_

### Node.js Version

23.10.0

### OS

MacOS

### Language

Java

### Language Version

Kotlin 2.1.10

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the BedrockKnowledgeBaseStack reproduction and compare the synthesized templates for eu-north-1 and eu-west-1, focusing on AWS::Bedrock::DataSource and AWS::Bedrock::KnowledgeBase. Confirm whether the regional resource types are supported by CloudFormation; done means the Kotlin CDK stack deploys successfully in Stockholm, or the issue documents the external service limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, kotlin, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.