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,
});
関連するコンテンツ
- 質問済み 7ヶ月前
- AWS公式更新しました 10ヶ月前
- AWS公式更新しました 1年前