aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
cfleming 2020-01-06T00:46:47.038100Z

Hi everyone. I have an issue with an existing static website on S3 fronted by CloudFront. I’m migrating it to use CDK for deployment. I redirect www to apex domain, so I have both http://domain.com and http://www.domain.com buckets set up, and the www one redirects to the apex address. This all worked fine when set up manually but when deploying via CDK I get AccessDenied errors when accessing the www address. The apex one works fine.

kenny 2020-01-06T19:09:22.043500Z

Haha that's fair. For us it's simply static website hosting -- no code changes needed. Switching Netlify <-> S3 would take no time at all. The automatic build previews and rollback features are fantastic.

cfleming 2020-01-06T20:31:14.043700Z

Yeah, I’ve heard nice things about Netlify from a few people now.

cfleming 2020-01-06T00:49:56.040600Z

The s3 bucket endpoint address looks like http://www.domain.com.s3-website-us-east-1.amazonaws.com. If I hit that address manually it works fine. However looking at the CloudFront configuration, the origin is being set up using an address like http://www.domain.com.s3.us-east-1.amazonaws.com - previously when I set CloudFront up by hand I used the endpoint address from the S3 console, and it all worked ok.

cfleming 2020-01-06T01:01:20.041600Z

Actually, the origin address seems to be a red herring. The issue seems to be that the bucket is being treated as a content bucket even though the console says it’s configured to redirect all requests. But this only happens when I access it via CloudFront. Directly hitting the endpoint URL works.

cfleming 2020-01-06T01:41:55.042600Z

Ok, TIL that S3 has a website mode and a REST mode, and that the REST mode doesn’t do website-like things such as redirects: https://stackoverflow.com/a/22750923

kenny 2020-01-06T02:42:40.042800Z

Tangent: we switched from an s3 hosted website to Netlify and it's fantastic. Big win over s3.

cfleming 2020-01-06T02:46:44.043Z

I looked at Netlify, but I’d also have to migrate my lambda functions, Dynamo DB etc, it would end up being a pretty big rewrite. CDK actually makes AWS much more palatable once all the bits are figured out.

cfleming 2020-01-06T02:47:25.043300Z

Plus I’m increasingly reluctant to build infrastructure on venture-backed startups. At least I know AWS isn’t going anywhere.