aws-samples / aws-cdk-examples

Example projects using the AWS CDK
Apache License 2.0
4.95k stars 2.1k forks source link

Simpler version of typescript/static-site #1018

Open shamsch opened 3 months ago

shamsch commented 3 months ago

Describe the feature

Currently, typescript/static-site uses cloudfront, acm, route53 to direct the traffic from http to https. I propose a simpler version of static-site that skips that part and only provide a direct public link to the s3 object.

Use Case

Having cloudfront, acm, route53 makes deployment of a static html file with S3 more complicated than it needs to be. Sometime all you need is a proof of concept - and in such case going the extra length to have https support does not justify itself.

Proposed Solution

Essentially keep the stack the same as before and only keep the s3 bucket and make it publicly accessible. Also aligning with the current folder structure of cdk init and it will be stable unlike the current typescript/static-site

So in essence, deploy a html file to a S3 bucket that is publicly accessible so as to be able to access the file from the internet

Other Information

No response

Acknowledgements

Language

Typescript

danstoner commented 2 months ago

It looks like the simplest possible s3 bucket website example is located in the documentation:

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_deployment-readme.html

edit: That doc leaves out the additional properties on the Bucket that are necessary to actually get it to work:

      publicReadAccess: true,
      blockPublicAccess: new s3.BlockPublicAccess({
        blockPublicAcls: false,
        blockPublicPolicy: false,
        ignorePublicAcls: false,
        restrictPublicBuckets: false,
      }),

AND the account-level S3 Public settings must be configured appropriately (in the AWS Console).