enable eventBridge prop on S3 bucket via CDK

0

Hi team,

I want to enable eventBridge notification on my S3 bucket via CDK,

I saw it was added as a property to the bucket props as part of this PR :

https://github.com/aws/aws-cdk/pull/18150

but I can't find it on the props

import { BlockPublicAccess, Bucket} from "@aws-cdk/aws-s3";

const myS3Bucket= new Bucket(
      this,
      "myS3Bucket",
      {
        versioned: false,
        publicReadAccess: false,
        blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
        eventBridgeEnabled: true,  -- error here .....
      }
    );

I have this error :

eventBridgeEnabled: boolean; }' is not assignable to parameter of type 'BucketProps'.

I even tried with CfnBucket but had same error

   const bucket = new CfnBucket(this, 'MyEventBridgeBucket', {
      eventBridgeEnabled: true,
    });

Argument of type '{ eventBridgeEnabled: boolean; }' is not assignable to parameter of type 'CfnBucketProps'. Object literal may only specify known properties, and 'eventBridgeEnabled' does not exist in type 'CfnBucketProps'

I want to simply to add it in my first declaration so I can keep those properties :

versioned: false,
publicReadAccess: false,
 blockPublicAccess: BlockPublicAccess.BLOCK_ALL,

how can I enable eventBridge on my S3 bucket via CDK ?

Thank you!

1개 답변
1

Hello there!

Please check what version of aws-cdk-lib you are using (e.g. with npm list | grep cdk)

According to CDK releases the change you are looking for (adding prop to enable EventBridge in S3 BucketProps #18076) is available since:

  • v2.20.0 for CDK v2
  • v1.152.0 for CDK v1
AWS
wolanlu
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인