2 ms·
I don't really understand the author's claims here. const streamsBucket = new s3.Bucket(this, 'StreamsBucket', { websiteIndexDocument: 'index.html', re
by nostrebored 7y ago
I don't really understand the author's claims here.
const streamsBucket = new s3.Bucket(this, 'StreamsBucket', { websiteIndexDocument: 'index.html', removalPolicy: RemovalPolicy.DESTROY })
/* Create a cloudfront endpoint to make it publicly accessible */
const streamsDistributionOai = new cloudfront.OriginAccessIdentity(this, 'StreamsBucketOAI', {});
const streamsDistribution = new cloudfront.CloudFrontWebDistribution(this, 'StreamsDistribution', {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: streamsBucket,
originAccessIdentity: streamsDistributionOai,
},
behaviors: [ {isDefaultBehavior: true} ],
}
]
});
Will create a bucket that will serve index.html from a non website bucket. Three lines of cdk code. If you need to populate the bucket, add another line to create a new BucketDeployment to populate the bucket.
All files are secured by OAI and not accessible over the public internet.