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,
});
相關內容
- 已提問 10 個月前
- 已提問 2 天前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 10 個月前
- AWS 官方已更新 1 年前