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 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen