News for hackers. Stuff that matters.
Re:The good parts of AWS: a visual summary by ggregoire on Tuesday March 17, 2020 @03:45PM (#22609437)
> 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

Re:The good parts of AWS: a visual summary by DVassallo on Tuesday March 17, 2020 @04:39PM (#22610111)
Book 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.

Re:The good parts of AWS: a visual summary by yingw787 on Tuesday March 17, 2020 @04:50PM (#22610252)
Not 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).

Re:The good parts of AWS: a visual summary by chickenpotpie on Tuesday March 17, 2020 @05:13PM (#22610494)
Also Netlify doesn't scale in pricing as well. 3 developers is $45 a month, but 4 developers is $1000 a month. There's also no SLA until the $1000 a month tier. They charge almost double for extra bandwidth. It's great for small teams, but they're not objectively better.
Re:The good parts of AWS: a visual summary by cactus2093 on Tuesday March 17, 2020 @05:21PM (#22610586)
Never used Netlify, but that seems odd. Isn't it a hosting provider? Unless you're really tiny team, usually you'd want a centralized process for running the build & deploy (rather than having any developer that wants to release something running the build on their slightly different local environment and deploying it directly), possibly hooked into a CD pipeline. Why do you need to pay per developer?
Re:The good parts of AWS: a visual summary by chickenpotpie on Tuesday March 17, 2020 @06:23PM (#22611215)
Here's their pricing page: https://www.netlify.com/pricing/

Looks like you can add extra developers on the lower tiers for $15/user/month, but they're still charging way more per GB than AWS does.

Re:The good parts of AWS: a visual summary by yingw787 on Tuesday March 17, 2020 @05:22PM (#22610588)
That's pretty cray-cray. I feel like you could just create a CloudFormation template, have a "Launch Stack" button, and get people to pay you to maintain it for $10 / user / month and have a company easy-peasy. Throw in backups via Batch, I think they use EC2 Spot instances so its crazy cheap.

I get that you should always charge more if possible, but I'm much more concerned with surviving during hard times, and there's just less to ablate away if you stick more or less to first principles.

Re:The good parts of AWS: a visual summary by Cthulhu_ on Wednesday March 18, 2020 @07:15AM (#22615348)
One benefit Netlify has is that it keeps a reference to multiple deploys, so you can always go back or deploy a development branch separately from production. Plus it does the building for you, which for a Hugo site is not really important but in our case (product website + shop) we used Gatsby which pulled data from several data sources (= secure access keys that ideally don't linger on dev machines).
Re:The good parts of AWS: a visual summary by LunaSea on Wednesday March 18, 2020 @07:22AM (#22615396)
You can already build automatically in GitHub Actions and Git saves your previous versions as well. No need for Netlify.
Re:The good parts of AWS: a visual summary by koolba on Tuesday March 17, 2020 @05:12PM (#22610485)
Add a “set -e” unless you want to publish a failed build.
Re:The good parts of AWS: a visual summary by yingw787 on Tuesday March 17, 2020 @05:23PM (#22610605)
I 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 :)
Re:The good parts of AWS: a visual summary by earthboundkid on Tuesday March 17, 2020 @09:12PM (#22612590)
There’s a Hugo flag for buildFuture. I have it turned on in Netlify branch deploys and off in prod. ;-)
Re:The good parts of AWS: a visual summary by uffe5 on Tuesday March 17, 2020 @05:26PM (#22610631)
Whether that helps or not depends on how the script is called. Unfortunately. Better to check the result of the command and call exit explicitly if you want to be sure.
Re:The good parts of AWS: a visual summary by earthboundkid on Tuesday March 17, 2020 @09:11PM (#22612579)
Netlify does branch deploys. I’ve hosted on S3+CF and Netlify. Both have their place, but Netlify has a great developer UX. S3 does not.
Re:The good parts of AWS: a visual summary by gen220 on Tuesday March 17, 2020 @09:53PM (#22612794)
Not refuting the UX point. It’s possible (at most an hour of work) to set up webhook-based deploys to s3. Not as turnkey as Netlify, but it is very possible to build your own great developer UX with a bit of elbow grease and pipes :).

If your time frame for hosting is 10+ years, I’d personally recommend to put your eggs in s3, (or the “s3 interface”, to be specific; whether it’s with AWS, DO, etc).

Re:The good parts of AWS: a visual summary by earthboundkid on Wednesday March 18, 2020 @01:58PM (#22619416)
That's not hard. What I'm talking about is giving each PR its own unique domain URL. That's a much bigger pain in the ass with S3+CF. I'm not even sure it can be done quickly because starting a new CF distribution takes like 10 minutes. I guess you'd need to hook into Route 53 somewhere or something?
Re:The good parts of AWS: a visual summary by bunsenhoneydew on Wednesday March 18, 2020 @03:51AM (#22614507)
S3+CF static hosting has a great interface, they just wrapped it in nice UI and called it Amplify Console.
Re:The good parts of AWS: a visual summary by earthboundkid on Wednesday March 18, 2020 @01:55PM (#22619388)
I could never figure out the Amplify docs. Maybe I was stuck in the marketing part of it, but I never saw something that stated clearly what it is or how it works. It was like "just click a, then b, then c" which is not useful for understanding what it's actually doing.

So, is Amplify just a simplified interface to S3+CF?

Re:The good parts of AWS: a visual summary by zomglings on Tuesday March 17, 2020 @05:32PM (#22610689)
My script looks very similar to yours, but with an additional (and optional) CloudFront cache invalidation step (on `/*`).
Re:The good parts of AWS: a visual summary by nerdjon on Tuesday March 17, 2020 @05:57PM (#22610928)
AWS Amplify makes it incredibly simple to do deploy a static website to s3 with cloud front in front of it.

Includes CD and Amplify itself (like Cloudformation) is free, you only pay for the resources you make.

AWS Amplify has been out for a couple years now, and it is also able to automate much more than just static websites.

So taking a look at the 2 options you mention, I am not seeing anything that those do that Amplify does not (but the opposite is not true, Amplify does a lot of things for you out of the box)

Re:The good parts of AWS: a visual summary by asymptotic on Tuesday March 17, 2020 @06:58PM (#22611530)
I agree that AWS doesn't yet provide a clean all-in-one package for static website hosting. I think AWS Amplify Console [1] is the current official "all-in-one" service but I haven't used it.

With the recent GA of AWS CDK [2] I would say that it is getting more and more possible to define your own development workflow that is tailored to your own static website hosting needs and better than just raw S3. AWS CDK is still difficult to use with some rough edges, and I know that setting up e.g. a CodePipeline and CI/CD is difficult.

Here is the CDK example for hosting a S3 origin + CloudFront CDN + custom TLS certificate + CloudFront invalidation on deployments static website [3]. Here is my personal version of it combining Hugo that took me a day to set up [4]. Still complicated, lot of rough edges, but offers a pleasant dev experience [5], I haven't yet built up a CI/CD pipeline.

Disclaimer: I work for AWS but my views are my own.

[1] https://aws.amazon.com/amplify/console/

[2] https://aws.amazon.com/cdk/

[3] https://github.com/aws-samples/aws-cdk-examples/blob/master/...

[4] https://github.com/asimihsan/asim_ihsan_io/blob/master/cdk/s...

[5] https://github.com/asimihsan/asim_ihsan_io/blob/master/READM...

Re:The good parts of AWS: a visual summary by bunsenhoneydew on Tuesday March 17, 2020 @07:12PM (#22611669)
> I agree that AWS doesn't yet provide a clean all-in-one package for static website hosting. I think AWS Amplify Console [1] is the current official "all-in-one" service but I haven't used it.

That's exactly what Amplify Console is, and it's really good.

Re:The good parts of AWS: a visual summary by debaserab2 on Tuesday March 17, 2020 @06:18PM (#22611172)
After initial configuration it's literally one command using the AWS cli to upload your site to s3.

I don't understand the eagerness to trade-off $/user instead of $/bandwidth (which is far, far cheaper in nearly every case) just to save a day or two of learning how to use a tool.

Re:The good parts of AWS: a visual summary by lentil on Tuesday March 17, 2020 @06:07PM (#22611052)
> The dev experience you get with Netlify and Zeit will almost certainly never be possible with AWS.

For static hosting, AWS Amplify is already a very similar experience to Netlify. Each is slightly better than the other in some ways, but overall they are really very similar.

Re:The good parts of AWS: a visual summary by bunsenhoneydew on Tuesday March 17, 2020 @07:10PM (#22611648)
I find the experience using AWS Amplify Console to be great, not dissimilar to Zeit or Netlify. It's a 'productisation' of the S3 and Cloudfront pattern and does its job very well imho. https://aws.amazon.com/amplify/console/
Re:The good parts of AWS: a visual summary by nujabe on Wednesday March 18, 2020 @08:24AM (#22615793)
Firebase Hosting is superior to any of those alternatives you mentioned (netlify, amplify, zeit etc) in terms of capability. With the added benefit of tight integration with other firebase products (analytics, authentication and cloud storage).
Re:The good parts of AWS: a visual summary by antonvs on Tuesday March 17, 2020 @08:12PM (#22612178)
Based on this and other comments of yours in the thread, it feels like you have some vested interest in advertising "Netlify and Zelt" (whatever those are) without declaring your interest in them.

If you truly have no interest in them other than as a user, then it seems as if you're not aware of alternatives such as AWS Amplify. You haven't responded to any of the comments pointing out the issues with your claims.

Whatever book you're a co-author of doesn't sound as though it's worth the price.

Re:The good parts of AWS: a visual summary by liamcardenas on Tuesday March 17, 2020 @04:52PM (#22610275)
Other than for DX, is there a reason to go with Netlify or Zeit? I personally don't care about this.
Re:The good parts of AWS: a visual summary by enahs-sf on Tuesday March 17, 2020 @05:10PM (#22610464)
I too, prefer to know how the sausage is made.
Re:The good parts of AWS: a visual summary by otabdeveloper2 on Wednesday March 18, 2020 @04:46AM (#22614733)
There's a much better alternative outside of AWS for everything that AWS provides.

As far as I can tell, AWS exists to optimize accounting and inter-departmental friction, and not to solve any technical problem.

Re:The good parts of AWS: a visual summary by chickenpotpie on Tuesday March 17, 2020 @04:00PM (#22609616)
This made me immediately skeptical of the article. S3 is the best option for static hosting 99.99% of the time.
Re:The good parts of AWS: a visual summary by mikst on Wednesday March 18, 2020 @07:29AM (#22615431)
I'm just not sure how you can sleep at night knowing aws can throw a $3000 bill at you any time essentially.
Re:The good parts of AWS: a visual summary by chickenpotpie on Wednesday March 18, 2020 @12:25PM (#22618361)
You can just setup a budget and shutdown traffic if it goes above it.
Re:The good parts of AWS: a visual summary by mikst on Thursday March 19, 2020 @07:20AM (#22626411)
That's true. What is the point of overpriced aws though if you don't want it to scale uncontrollably?
Re:The good parts of AWS: a visual summary by tobilg on Tuesday March 17, 2020 @03:57PM (#22609573)
You can have a look at https://github.com/tobilg/serverless-aws-static-websites if you want to set this up with one command
Re:The good parts of AWS: a visual summary by lookingforsome on Tuesday March 17, 2020 @05:14PM (#22610520)
good resource thanks @tob
Re:The good parts of AWS: a visual summary by ddoolin on Tuesday March 17, 2020 @03:46PM (#22609450)
We 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.

Re:The good parts of AWS: a visual summary by harrisonjackson on Tuesday March 17, 2020 @04:59PM (#22610359)
In case you don't feel like clicking through to gumroad and opening the sample PDF...

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...

Re:The good parts of AWS: a visual summary by DVassallo on Tuesday March 17, 2020 @04:36PM (#22610080)
The entire chapter on DynanoDB is free in the sample. The answer to your question is there: https://gumroad.com/l/aws-good-parts
Re:The good parts of AWS: a visual summary by yingw787 on Tuesday March 17, 2020 @04:10PM (#22609740)
This is exactly my stack. S3 + CloudFront + Route 53.
Re:The good parts of AWS: a visual summary by ummonk on Tuesday March 17, 2020 @04:12PM (#22609775)
Yup, 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.
Re:The good parts of AWS: a visual summary by lappet on Tuesday March 17, 2020 @05:35PM (#22610723)
+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
Re:The good parts of AWS: a visual summary by ckcheng on Tuesday March 17, 2020 @06:15PM (#22611141)
Do 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...

Re:The good parts of AWS: a visual summary by nostrebored on Tuesday March 17, 2020 @06:25PM (#22611235)
CloudFront 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!

Re:The good parts of AWS: a visual summary by ckcheng on Tuesday March 17, 2020 @07:49PM (#22611960)
Thanks. Yeah, same files and geographic area.

I'm paying for either S3 or CloudFront for distribution regardless, and either way their transfer out to internet pricing looks similar:

https://aws.amazon.com/cloudfront/pricing/

https://aws.amazon.com/s3/pricing/

Transferring from S3 to CloudFront looks free, so I might give it a try. Already have S3, just have to set up CLoudFront.

I hope I didn't miss something on pricing... really can't afford bill shock!

Re:The good parts of AWS: a visual summary by lappet on Tuesday March 17, 2020 @06:21PM (#22611196)
Sorry, 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.
Re:The good parts of AWS: a visual summary by ckcheng on Tuesday March 17, 2020 @07:50PM (#22611973)
Thanks. 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.

Re:The good parts of AWS: a visual summary by lowbloodsugar on Tuesday March 17, 2020 @05:57PM (#22610925)
Here's a tutorial on an S3 blog. It's on S3. http://www.jamiebriant.com
Re:The good parts of AWS: a visual summary by antman on Wednesday March 18, 2020 @04:34AM (#22614692)
And it's on http
Re:The good parts of AWS: a visual summary by jessaustin on Wednesday March 18, 2020 @06:15AM (#22615106)
https://www.jamiebriant.com/ actually exists; it's just using an "invalid" CloudFront wildcard cert. That site needs to use Certificate Manager.
Re:The good parts of AWS: a visual summary by lowbloodsugar on Wednesday March 18, 2020 @08:47PM (#22623166)
Yeah, things have moved forward since 2011! Should probably update that.
Re:The good parts of AWS: a visual summary by vagab0nd on Saturday March 21, 2020 @11:29AM (#22647182)
Getting 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.
Re:The good parts of AWS: a visual summary by skellera on Tuesday March 17, 2020 @04:08PM (#22609704)
Just curious, do you have it set up with any sort of CI/CD?
Re:The good parts of AWS: a visual summary by beardface on Tuesday March 17, 2020 @04:47PM (#22610221)
You 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.

Re:The good parts of AWS: a visual summary by celim307 on Tuesday March 17, 2020 @07:01PM (#22611557)
aws pipeline is one more cloudformation template, very low investment