1 回答
- 最新
- 投票最多
- 评论最多
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,
});
相关内容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前