By using AWS re:Post, you agree to the Terms of Use
/enable eventBridge prop on S3 bucket via CDK/

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 Answers
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
answered 25 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions