1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
2
Hello.
I think you need to add "websiteIndexDocument".
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html
The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket.
So I think the code should be as follows.
const myBucket = new s3.Bucket(this, 'MyBucket', {
bucketName: 'my-bucket-name',
publicReadAccess: true,
blockPublicAccess: {
blockPublicAcls: false,
blockPublicPolicy: false,
ignorePublicAcls: false,
restrictPublicBuckets: false,
},
removalPolicy: cdk.RemovalPolicy.DESTROY,
websiteIndexDocument: 'index.html'
});
new s3Deploy.BucketDeployment(this, 'BucketDeploymentId', {
sources: [s3Deploy.Source.asset("./src/website")],
destinationBucket: myBucket,
});
Contenus pertinents
- demandé il y a 3 mois
- demandé il y a un an
- demandé il y a 2 mois
- AWS OFFICIELA mis à jour il y a 10 mois