1 Antwort
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
0
Need to post answer to get the code formatting. Even with v1.153.1
npx cdk@1.153.1 init app --lanaguage typescript
npm install @aws-cdk/aws-s3
npm install @aws-cdk/aws-s3-deployment
Create a file to upload
mkdir web-dist
echo "Hello World" > ./web-dist/index.html
Go to ./lib/<name of the cdk project>.ts
import * as cdk from '@aws-cdk/core';
// import * as sqs from '@aws-cdk/aws-sqs';
import { Bucket, BlockPublicAccess } from '@aws-cdk/aws-s3';
import { BucketDeployment, Source } from '@aws-cdk/aws-s3-deployment';
export class RepostTemp2Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const bucket = new Bucket(
this,
"myBucket",
{
versioned: false,
publicReadAccess: false,
blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
eventBridgeEnabled: true,
}
);
new BucketDeployment(this, 'DeployIndex', {
destinationBucket: bucket,
sources: [Source.asset('./web-dist')],
});
}
}
Now you can deploy the cdk project.
npx cdk deploy
Going to the deployed bucket and checking the properties shows:
Send notifications to Amazon EventBridge for all events in this bucket On
Maybe you have something else that is undoing the setting? Would need to see more of the app to understand what is going on.
beantwortet vor 2 Jahren
I'm using this package with my code : @aws-cdk/aws-s3-deployment
Updated to include s3-deployment. Did my answer solve your problem or are you still having trouble?
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
I just created a cdk project using 2.21.1 and it worked. Send notifications to Amazon EventBridge for all events in this bucket On
What version are you using?
I'm using version 1.153.1