8 ms·
> AVOID using S3 for static web hosting (No HTTPS). I would absolutely recommend S3 for static web hosting. Just add CloudFront on top if you need HTTPS, it t
by ggregoire 7y ago
> AVOID using S3 for static web hosting (No HTTPS).
I would absolutely recommend S3 for static web hosting. Just add CloudFront on top if you need HTTPS, it takes like 2 clicks.
If anyone interested, I answered on StackOverflow how to deploy a front end app (React, Vue, etc) to S3: https://stackoverflow.com/q/41250087/652669 https://stackoverflow.com/q/41250087/652669
- ddoolin 7y agoWe run almost all of our UIs on S3 static hosting behind CloudFront. Works like a champ. I'm a bit stumped on why they say to avoid using local indices in DynamoDB, though.
- DVassallo 7y agoThe entire chapter on DynanoDB is free in the sample. The answer to your question is there: https://gumroad.com/l/aws-good-parts https://gumroad.com/l/aws-good-parts
- harrisonjackson 7y agoIn case you don't feel like clicking through to gumroad and opening the sample PDF... https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/LSI.html#LSI.Creating https://docs.amazonaws.cn/en_us/amazondynamodb/latest/develo... Here is a link to the AWS docs referencing the limitation of local secondary indices. Any table with a local secondary index is limited to 10GB per partition key. The authors may have misinterpreted this limitation. >Once you create a local index on a table, the property that allows a table to keep growing indefinitely goes away. It limits the value for that partition key but does not limit the overall size of the table...
- tobilg 7y agoYou can have a look at https://github.com/tobilg/serverless-aws-static-websites https://github.com/tobilg/serverless-aws-static-websites if you want to set this up with one command
- lookingforsome 7y agogood resource thanks @tob
- chickenpotpie 7y agoThis made me immediately skeptical of the article. S3 is the best option for static hosting 99.99% of the time.
- mikst 7y agoI'm just not sure how you can sleep at night knowing aws can throw a $3000 bill at you any time essentially.
- chickenpotpie 7y agoYou can just setup a budget and shutdown traffic if it goes above it.
- mikst 7y agoThat's true. What is the point of overpriced aws though if you don't want it to scale uncontrollably?
- skellera 7y agoJust curious, do you have it set up with any sort of CI/CD?
- beardface 7y agoYou don't have to. You can, however, if you want to. I used this stack (S3, CF, R53, & ACM for SSL cert) to deploy a static site built using Hugo, which can deploy directly to an S3 bucket. If you're crafting the site yourself without a builder, you can just use the AWS CLI to `cp` the files to the S3 bucket. You may need to invalidate the CF distribution if you want everything updated quickly worldwide.
- celim307 7y agoaws pipeline is one more cloudformation template, very low investment
- yingw787 7y agoThis is exactly my stack. S3 + CloudFront + Route 53.
- ummonk 7y agoYup, having had AWS experience from work, this is the exact stack I always use whenever I need to build a static site; I could use an ordinary host but I'm less sure about the security guarantees there and to what extent they will be able to handle load.
- DVassallo 7y agoBook co-author here. (Not article author.) The recommendation against using S3 for static hosting is that there are much better alternatives outside of AWS. The dev experience you get with Netlify and Zeit will almost certainly never be possible with AWS.
- yingw787 7y agoNot to refute your claim, but this is my 3-line bash script in order to build and upload a static bundle: """ #!/usr/bin/env bash rm -rf public hugo --verbose aws s3 sync ./public s3://$BUCKET_NAME --profile s3_personal """ You can set custom TTL for CloudFront to 0 for instant refresh in production. Dev server is `hugo server`, `hugo` is a single Go binary you can Dockerize with --net=host and --volume=$(pwd):/app to use your own dev environment. If you don't maintain too many large static assets, your cost is like 5 cents a month, and I think that's a competitive price, not AWS being generous. $12 / year for a custom domain via ICANN, and Route 53 manages A/AAAA/CNAME/MX records for free. Again, not to refute your claim. I'm a single author, who publishes as a hobby, with a single dev and a single prod environment, so if things break down (it hasn't for years), it's easy to fix. It's much different than content marketing and enterprise use cases. Even so, I would rather start here and add a static CMS like Forestry before considering a custom solution like Netlify (which is probably built on top of AWS anyways).
- koolba 7y agoAdd a “set -e” unless you want to publish a failed build.
- yingw787 7y agoI actually noticed I had a few incorrect dates, about two weeks after I published the posts. One annoying thing about hugo server is that you can't see draft posts timestamped in the future, which makes it hard to schedule things. My stack definitely could use improvement in a real-life production setting :)
- 7y ago
- lappet 7y ago+1. Although the dev experience is convoluted on AWS, you end up learning more and I think it is quite cheap as well. I have a tutorial as well on how to deploy a static website using CloudFront, S3 and Route53 : https://raviramanujam.com/post/blog/meta.html https://raviramanujam.com/post/blog/meta.html
- ckcheng 7y agoDo you know what the cost difference is between CloudFront and S3 in terms of serving big files like video files? For convenience and other reasons, I use S3 to publish some videos for a small group (~30) I teach. Wondering if serving that thru CloudFront would be cheaper. This is especially important to me now as I'm doing this while everyone here is under voluntary self-isolation so I'm relying on video more. Not that S3 was ever that expensive for me but if CloudFront is cheaper...
- lappet 7y agoSorry, I don't know the answer to that specific question. I do want to point out that CloudFront is just a CDN, you would use it in conjunction with something like S3.
- ckcheng 7y agoThanks. Yeah, I have S3. Just wondering if CF would save costs in this simple scenario. S3 transfer to CF is free I think so might be worth my giving it a try.
- nostrebored 7y agoCloudFront will likely help you save costs if there is a benefit to caching the content. For example, if all of those 30 download the same file, from a similar geographic area around the same time, you should see some cost reduction. Otherwise, it might not be worth the cost of the distribution!
- ckcheng 7y ago
- lowbloodsugar 7y agoHere's a tutorial on an S3 blog. It's on S3. http://www.jamiebriant.com http://www.jamiebriant.com
- antman 7y agoAnd it's on http
- jessaustin 7y agohttps://www.jamiebriant.com/ https://www.jamiebriant.com/ actually exists; it's just using an "invalid" CloudFront wildcard cert. That site needs to use Certificate Manager.
- lowbloodsugar 7y agoYeah, things have moved forward since 2011! Should probably update that.
- vagab0nd 7y agoGetting https setup with S3 is the easy part. What I'm struggling with is getting www->root redirect to work with https. I've tried quite a few setups and none worked perfectly.