Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
cloudFrontOriginAccessIdentityConfig: {
comment: `CloudFront OriginAccessIdentity for ${bucket.bucketName}`,
},
},
);
bucket.grantRead(
new CanonicalUserPrincipal(originId.attrS3CanonicalUserId),
);
if (!disableUpload) {
const placeHolderSource = path.join(__dirname, '..', 'website');
new BucketDeployment(this, 'WebsiteDeployment', {
sources: [Source.asset(source || placeHolderSource)],
destinationBucket: bucket,
retainOnDelete: removalPolicy === RemovalPolicy.RETAIN,
});
}
this.s3OriginConfig = {
originAccessIdentityId: originId.ref,
s3BucketSource: bucket,
};
}
}
],
aliasConfiguration: {
acmCertRef: cert.certificateArn,
names: [domainName],
},
};
let distribution = new CloudFrontWebDistribution(
this,
'WebSiteDistribution',
distributionConfig,
);
const placeHolderSource = path.join(__dirname, '..', 'docs');
new BucketDeployment(this, 'WebsiteDeployment', {
sources: [Source.asset(placeHolderSource)],
destinationBucket: websiteBucket,
distribution,
retainOnDelete: false,
});
new PipelineConstruct(this);
}
}