in provision/lib/frontend-stack.ts [10:53]
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const bucket = new s3.Bucket(this, `${ID_PREFIX}-Bucket`, {
websiteIndexDocument: '',
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
});
const originAccessIdentity = new cloudfront.OriginAccessIdentity(this, `${ID_PREFIX}-AccessIdentity`);
const distribution = new cloudfront.CloudFrontWebDistribution(this, `${ID_PREFIX}-Distribution`, {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: bucket,
originAccessIdentity,
},
behaviors: [
{ isDefaultBehavior: true },
],
}
],
errorConfigurations: [
{
errorCode: 404,
errorCachingMinTtl: 0,
responseCode: 200,
responsePagePath: '/',
},
{
errorCode: 403,
errorCachingMinTtl: 0,
responseCode: 200,
responsePagePath: '/',
}
],
});
new s3Deployment.BucketDeployment(this, `${ID_PREFIX}-Deployment`, {
sources: [s3Deployment.Source.asset(path.join(__dirname, '..', '..', 'management-ui', 'dist'))],
destinationBucket: bucket,
distribution,
distributionPaths: ['/*'],
});
}