The Free Stack – Running Your Application for Free on AWS - <AUTHOR> http://p.agnihotry.com/post/the_free_stack_aws/ <comment><USER2> There are ways to _actually_ run your application for free using the big players' free services. One route I've looked at for e-commerce is storing product data on Stripe, hosting product pages with Netlify, pulling product data during static site build, triggering a build when Stripe data gets updated, and using Netlify's wrapper around AWS Lambda for free FaaS (AWS Lambda can be free forever, but you also need AWS API Gateway which isn't free forever). This results in the only fee being a CC fee.

I've put together a demo over at libra-shop.org. It definitely still needs some work, but I think most of the important bits are all sorted out.

Of course, the biggest issue with using free tiers for your entire stack is that you have no guarantee that the services will be running forever. (eg. Netlify could stop providing a free AWS Lambda connection)

<comment><USER3> All of this work and complete dependency on third party services is worth it? Isn't much easier to create a lightweight app in say, Go and SQLite, and pay a so-low-to-be-insignificant monthly fee?

<comment><USER4> I wonder what amount of money would be sufficient to create the digital equivalent of a foundation to ensure the uptime of a website/project. It would be kinda cool to put away a few grand to ensure something stays up "forever".

<comment><USER5> The price of forever ranges from a few hundred to millions depending on how resilient you want to be.

In reality, it would probably be more effective to dedicate nearly $0 to infrastructure and $N,000.00 to an endowment for 1-3 hours of engineering time each year.

Figuring out how to host a static site for free and moving the site to that service requires almost no time for a competent engineer. But finding a solution that is _guaranteed_ to exist in 100 years with zero human intervention would probably cost millions...

<comment><USER4> That's along the lines of what I was thinking. The www.mywebsite.com foundation, worth a whopping 10k, invests it's 300$ annual interest in updating the hosting for www.mywebsite.com.

</comment></comment></comment></comment></comment><comment><USER6> This is a nice write up. My only concern is that these days we think that the alternative to free is $40 to hundreds of dollars a months for something decent.

In the days of shared hosting, you could drop $3 to $5 to host your small website and expect your website to decently perform. But with your DO/Linode, you can expect excellent performance for the same price.

Only last month my two $5 droplets handled 5 million web requests from a viral post.

<comment><USER7> For 5 Euros per month a cloud VPS at Hetzner.com. comes with 2 CPUs and 4GB RAM. That's 8 or maybe 16 times the RAM that Facebook probably launched with plus extra CPU and SSD disk speed. All these cobbled-together free tiers may be slightly cheaper but the added complexity I can do without. It just seems like tech for tech's sake.

</comment></comment><comment><USER8> There are a lot of naysaying in the comments but I think it's a nice write-up and if you are interested in doing something like this I can say for sure it is possible based on my own experience. One of my side projects, [https://cmdchallenge.com](https://cmdchallenge.com) is setup almost identical. Cloudfront / api gateway / dynamodb and is covered a bit in this blog post [https://about.cmdchallenge.com/building- cmdchallenge.html](https://about.cmdchallenge.com/building-cmdchallenge.html) .

My last month's AWS bill (not in the free tier anymore) was only $2.23. For the runner that runs arbitrary shell commands I used to run a t2.micro in AWS but when the free tier expired I moved that over to gcp and I'm burning through their credits. I'm also using gitlab ci/cd to periodically renew the docker instance that runs shell commands.

It only works because there isn't much traffic obviously, and api requests are not made on every page load.

<comment><USER9> Wow, just want to say nice work on whatever validation method you are using...

      # You have a new challenge!
      # There is a file named "access.log" in the
      # current directory. Print the contents.
      #
      bash(0)> tac access.log | tac
      126.96.36.199 - - [09/Jan/2017:22:29:57 +0100] "GET
      /posts/2/display HTTP/1.0" 200 3240
      22.214.171.124 - - [09/Jan/2017:22:30:43 +0100] "GET
      /posts/foo?appID=xxxx HTTP/1.0" 200 1116
      188.8.131.52 - - [09/Jan/2017:22:34:33 +0100] "GET
      /pages/create HTTP/1.0" 500 3471
      22.214.171.124 - - [09/Jan/2017:22:35:30 +0100] "GET
      /posts/foo?appID=xxxx HTTP/1.0" 500 2477
      22.214.171.124 - - [09/Jan/2017:22:38:03 +0100] "GET
      /bar/create HTTP/1.0" 200 1116
      220.127.116.11 - - [09/Jan/2017:22:42:18 +0100] "GET
      /posts/1/display HTTP/1.0" 200 2477
      126.96.36.199 - - [09/Jan/2017:22:44:25 +0100] "POST
      /posts/1/display HTTP/1.0" 200 3471
      251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET
      /posts/foo?appID=xxxx HTTP/1.0" 200 2477
      22.214.171.124 - - [09/Jan/2017:22:52:31 +0100] "DELETE
      /posts/2/display HTTP/1.0" 404 2477
      188.8.131.52 - - [09/Jan/2017:22:57:11 +0100] "GET
      /posts/foo?appID=xxxx HTTP/1.0" 200 3471
      #     Correct!
      # You have a new challenge!
      # Print the last 5 lines of "access.log".

<comment><USER10> He probably just validates the output. You can do "whatever" as long as it generates the output.

</comment></comment></comment><comment><USER11> I read this, and I think: wow, that's extraordinarily expensive. The stack he designs is $20/mo for 1,000 user sessions/day.

Back in the days of cPanel/LAMP shared hosting, you'd have similar capability for $5/mo.

<comment><USER12> With a basic DO droplet, you can still do that for $5/month, and hey, if it takes off your app won't depend on a bunch of expensive proprietary software. Also I'm guessing that if cost is a concern, denial of service is preferable to blowing the bank under unanticipated high loads. Maybe I need to drink more AWS/GCP kool-aid though and see the light.

<comment><USER13> Recently I've been fascinated at gap between server providers these days. It seems each provider is either:

\- Enterprise public cloud, AWS/GCP/Azure, expensive but scalable and enterprise friendly

\- Developer public cloud, Linode/DO, cheap and easy to use

Although I say that AWS/GCP/etc are expensive, they obviously have negotiable prices for large customers. I doubt the smaller providers do that.

But it makes me wonder why people use AWS/GCP when the other providers are so much cheaper. How do Linode/DO offer such good prices? Would they kick me off if I actually maximized the server capacity they offer, like a shared cPanel host would do, back in the day?

<comment><USER14> I wouldn't consider VPS providers part of "the cloud". You simply rent a (virtual) server. With AWS and the like, you pay for their automation of services. You don't need to manually deploy load balancing, CDNs, DDoS mitigation, security hardening, and the like. The big pitch is that you're paying a bit more in order to phase out your IT team.

<comment><USER15> > The big pitch is that you're paying a bit more in order to phase out your IT > team.

Really? I have to say I don't understand it. I remember the "NoOps" movement from a few years ago and I just find the whole concept around it to be almost hilarious; kind of like Salesforce's old "No Software" logo (which is nowhere to be found in their newer marketing).

As I see it, as long as your organization has people using IT in any capacity at all, you will need someone in charge of IT Operations. Whatever you may want to call it: DevOps, or SRE, or PE, or even if you just decide it's something that each of your regular devs is going to be doing, it's a function that needs to be done.

Someone needs to be able to set up the systems, monitor them, scale them, secure them, and troubleshoot issues. It doesn't matter how well-engineered and maintained and automated the components you rely on are, they will break in various compound fractures and you will need to deal with the downtime and potential corruption to your composite system.

I'll eat my hat if you can point me towards a single non-trivial software service that has been running continuously without any "IT".

<comment><USER16> _As I see it, as long as your organization has people using IT in any capacity at all, you will need someone in charge of IT Operations. Whatever you may want to call it: DevOps, or SRE, or PE, or even if you just decide it 's something that each of your regular devs is going to be doing, it's a function that needs to be done._

That's true, but I don't need to worry about the server that my database, load balancer, queuing system, RedisCache, storage, etc. is running on. I only have to worry about my applications and the actual database. If I need to provision more hardware, it's a click of a button (well actually updating my CloudFormation template).

There is an entire level of both hardware and operating system maintenance that I don't have to worry about.

<comment><USER17> >There is an entire level of both hardware and operating system maintenance that I don't have to worry about.

Right. So you traded [relatively] inexpensive OS and infrastructure maintainers for [relatively] expensive application and tier maintainers.

</comment></comment></comment></comment></comment></comment></comment><comment><USER18> Bad title. It's not free, and after 12 months it's even very expensive compared to alternatives, considering what one gets for the price.

A couple of cheap VPSs would be cheeper and have way more headroom for the price.

<comment><USER19> Yup. It's not free even for the first 12 months, even assuming upper bounds on load.

$6.35 != $0. (For any numerical value of $ not equal to zero.)

</comment></comment><comment><USER20> What's wrong with using RDS in production? I'd rather do that than build around a vendor-lock-in Amazon offering when not strictly necessary. I'd also rather do that than administer a database myself.

<comment><USER21> "...AWS RDS Sevice. It offers t2.micro for free during the first 12 months. It is fine for development. However, I will not recommend using it in production."

I think maybe they were talking specifically about not using the t2.micro instance size in production.

<comment><USER22> Do you know what the downsides would be of using a t2.micro in production (for a low volume of requests)?

</comment></comment></comment><comment><USER23> I think this is the wrong way to go about building a free stack, given the vendor lock-in problem. I use a lot of free services from Netlify, for example, but I'm cautious about relying on anything that I can get _only_ from Netlify. I feel a lot better if I can list 3+ providers who _all_ provide a free tier that meets my needs (even if some aren't quite as present to use). That way, I know I have somewhere else to go if I need to— _and_ I feel better than I won't need to because the provider _knows_ I have other options.

<comment><USER24> What Netlify alternatives have you prepared? eg Github pages

</comment></comment><comment><USER25> With all costs that goes into building a business (directly in $ or indirectly in hours) is it worth going down the path of saving money to this degree?

Setup heroku in <1 hour for <$100/month, forget about hosting and go build your product.

If $100/month breaks you, I think you're in the wrong path anyways.

<comment><USER26> You're discounting hobby projects or small side businesses that don't generate a lot of revenue. For those, much more than a few bucks a month may be a deal- breaker.

<comment><USER16> I've been called a mercenary before, but the only reason I spend time working on software development "hobby projects" is with the sole aim of learning new skills that will make me more money on my job/contract work or at least keep me up to date with my skills. For that reason alone, I use AWS for side projects. Companies pay well for "AWS Architects". If I want to do a hobby project and save money, I could just as easily set up my own server and use my own gigabit home internet.

</comment></comment></comment><comment><USER27> I am not convinced that you really need lambda and all that complexity. I also don't really like the characteristics of Lambda, taking forever to wake up and limited debugging. A $5 DO/Hetzner Instance can already do a lot if you pay a bit attention to performance. I run a small Golang Api on DO for $5, using DynamoDB and some Cloudflare Caching (free) and it can handle quite a lot of traffic.

</comment><comment><USER28> I think the complexity of AWS's pricing is what led me to use the simplicity of AWS' lightsail offering.

No free tier, but the free tier is frought with potential for overrun. Lightsail is not.

[https://aws.amazon.com/lightsail/](https://aws.amazon.com/lightsail/)

<comment><USER29> That looks a lot like Digital Ocean's offering - anyone tried both who can compare Lightsail vs DO?

edit: Blog post that says they are about equal, Lightsail has AWS integration but DO is a but more full-featured as of the writing ([https://cloudacademy.com/blog/amazon-lightsail-vs-digital- oc...](https://cloudacademy.com/blog/amazon-lightsail-vs-digital-ocean/))

</comment></comment><comment><USER30> I wonder how this compares with App Engine's free tier? That's what I use for hobby projects that I don't want to pay a monthly fee on.

<comment><USER31> I do the same but haven't calculated just what the gae free tier would cover in the way the author did

</comment></comment><comment><USER32> I always enjoy articles like this, but must counterbalance with the vast vast cost saving of working with a stack with which you're familiar.

</comment><comment><USER33> Is it generally reliable asking Amazon support what capacity you need for a particular use case, so you're not buying more than needed? e.g. a service that might be used once per day for a minute, and another day it might get used a dozen times for maybe an hour, and only during fixed business hours. And there are general purpose, compute optimized, storage optimized, etc. But what if the service is more network latency sensitive than either storage or compute sensitive?

Or are there 3rd party estimators that do a better job of telling you what kind of instance to get? Or just pick a general purpose instance, run it for a week, and then tweak it?

<comment><USER34> I am on GCP but I usually request/allocate more and once in production for a few weeks, I can turn some things down and others up. That is if your product/setup is new and you aren't sure how everything will interact once live (in terms of perf).

Otherwise, for Lambda there is on Github a repo with a script that will publish your code in every configuration possible, run stress tests, and only keep the most optimum (perf/cost).

<comment><USER35> Hi, could you share the link of said repo?

<comment><USER36> I searched around and closest I found was [https://github.com/Nordstrom/serverless- artillery](https://github.com/Nordstrom/serverless-artillery)

</comment></comment></comment></comment><comment><USER37> I recently went through this, though with the (arbitrary) goal of running for free indefinitely. This is tougher, since you can't use API Gateway and need to throttle your dynamo operations.

SQS ended up being the key to making this work: everything is asynchronous, and the js SDK is used to enqueue messages directly from the frontend.

That setup is described in [https://www.simonmweber.com/2018/07/09/running- kleroteria-fo...](https://www.simonmweber.com/2018/07/09/running-kleroteria- for-free-by-abusing-free-tiers.html), if you're interested.

</comment><comment><USER38> TL;DR: Not free, but ~$6/year for the first year, ~$20/year thereafter

<comment><USER39> I think I lose more coins out of my pocket on the street yearly

<comment><USER40> If you're loosing $20 worth of coins out of your pocket somewhere on the street on a yearly basis you're either dealing with a hell of a lot more coins than the average person or you're one clumsy individual.

<comment><USER41> It depends. US coins larger than 25c are uncommon.

But other countries have $1 and $2 coins, with paper bills only starting at $5.

Transit tokens in Toronto are tiny and worth $3. I've dropped a few because they catch on my phone case edge.

<comment><USER42> Recently I thought I've lost a €5 banknote because some toll machines in Italy send cash[0] flying as if they were doing it with contempt.

I found it eventually along a €2 coin somebody left there. On my way back I also found a €1 coin and a 50c one. I guess people lose a measurable amount of cash this way.

[0] Non-Italian cards don't work on Italian motorways - only cash. Knowledge I acquired through error of my own so now other people don't have to.

<comment><USER43> Huh. How'd that work then? Did they just fine you or send you a bill later?

<comment><USER42> Once they notice that someone's clogging the toll booth you receive a receipt with payment details and you have 14 days to do that after which interest starts accumulating.

In one instance in Venice though the employee preferred to argue with me over the speakerphone insisting that I "insert euro" even though I didn't have any cash one me(there are no ATMs on the motorways - something I learned that day).

His line of thinking was that I want the receipt so that I can avoid paying by never returning to Italy.

</comment></comment></comment></comment></comment></comment></comment><comment><USER44> How would this work with a more standard webpage. For example, Laravel (PHP) on the backend with a Relational Database like MySQL?

<comment><AUTHOR> AWS Lambda does not support PHP. You will need to spin up an EC2 instance for running PHP and another instance in RDS for MySQL. For development, you can spin up t2.micro on EC2 and RDS and pay $0 but pick another instance type when you go live to production.

</comment></comment><comment><USER45> Why is everyone so concerned with $20/mo? If you're running a business, this should be the least of your concerns. Building on AWS means easy scaling for the future.

Who wants to redesign their entire project if it takes off?

</comment><comment><USER46> Not only is this stack free, it's easy to develop and set up and operate.

Here's a boilerplate Go app that sets up this stack:

[https://github.com/nzoschke/gofaas](https://github.com/nzoschke/gofaas)

</comment><comment><USER47> That's a rather misleading title. More like, Running Your Application for Free on AWS for the first 12 months (and then $20/mo after...)

I'm obsessive about optimizing cost on cloud platforms. I tend to make many, small hobby/experimental/etc projects. So I've long needed to find every way I can to ensure the costs for these projects remains small. $20/month is fine for a single project, but 20 projects? Yeah...

I know a lot people just look at cloud service pricing from the perspective of a startup. But I can't be the only one who uses cloud services for small, hobby/experimental/etc projects. So perhaps my insights will be helpful.

TL;DR: Use Google Cloud. App Engine Standard if you can.

When it comes to cost at small and medium scale, it's _really_ hard to beat Google Cloud. Check their Always Free tier: [https://cloud.google.com/free/](https://cloud.google.com/free/) That'll cover pretty much everything you need for small scale projects. You can grab a tiny VM, some Storage, some Datastore, all for the low, low price of $0/mo "forever". On top of that I've found their service pricing to either be on-par with AWS, cheaper, or if it isn't cheaper it's more granular than AWS so your off-the-lot prices end up cheaper anyway. For example AWS's managed NoSQL service requires you to allocate processing bandwidth up-front, which means there is a minimum cost no matter how little you use. Gcloud's is just charged based on usage. Don't use it? It's free.

Azure is interesting and has _some_ always free tier like Google Cloud. Their prices have come down a _lot_ in the past few years. They're worth a look if you haven't checked in awhile. But they're still up-and-coming in a lot of ways. E.g. their Container Registry is charged by how much disk you've allocated, rather than how much you've used. GCloud CR charges based only on usage, and gets roped into your Storage usage so it's part of the Always Free tier.

Gcloud's App Engine Standard Environment is a _beast_ for cost optimization. If you can fit your project into an App Engine + Datastore shaped hole, your project will absolutely, no strings attached, cost _nothing_ at the small scale. And when your project suddenly gets rocket fuel, it'll scale automatically with no effort on your part at reasonable cost.

(Do not even look at Flexible Environment. Its pricing is ludicrous.)

The BIG CAVEAT to Google Cloud is the usual Google failings. Their services tend to be unreliable (not the case for App Engine), their customer support is atrocious, their automated systems may randomly ban you and nuke your projects, and they may increase service pricing 25x with short notice when you least expect it.

I can't emphasize those caveats enough. Tread carefully. I'm sure others will chime in with their horror stories for AWS/Azure/etc. But Gcloud comes up on the HN news feed more often than the other cloud providers for a reason.

(This is all for people who want general cloud infrastructure. If you just need servers, there's of course the usual Vultr, et. al. with just low cost VMs.)

EDIT: For reference, I'm currently running some 12 or so small, personal projects in Gcloud right now. Some are "dead" projects, others are actively used by myself, and a rare few are used actively by a small user base. My monthly costs for all those projects is currently ~$1/mo all-in. A lot of that stuff lives on App Engine, which means I've had to do no maintenance on them in ... well some of them have been their for _years_ now without me touching them.

One of my previous companies transitioned from AWS to Gcloud for cost reasons. That move cut the cloud expenses down to 25% of what they were, and also enabled us to add new features (because it was not possible to deploy them to AWS without it costing absurd amounts of money). But I'll also note that the transition was incredibly painful due to Gcloud's various failings [luckily foisted on one of my new hire's who enjoyed the learning experience].

<comment><USER9> Note that that tiny VM/compute instance only comes with 1G of transfer, which you might use just doing a speedtest.. if anything close to normal transfer for a public facing site traverses that VM, you will see charges for sure.

<comment><USER47> Yeah, bandwidth is exceedingly expensive on all the cloud providers. If you're going to use general cloud infrastructure, that's impossible to avoid. (Again excluding simpler providers like Digital Ocean where you get a terabyte or two of bandwidth included).

I've taken to throwing CloudFlare in front of any of my personal services that serve static content and which are in danger of using a lot of bandwidth. Bandwidth served through CloudFlare is free, so as long as you're hitting their cache you won't see any charges at your cloud.

<comment><USER9> Good point, however, may as well just use Netlify if we're just talking about static assets. Anyway, the 600M always free VM instance is a pretty awesome freebie for sure. There's plenty you can do with it, even if you have to end up paying some cents for BW.

</comment></comment></comment></comment><comment><USER48> Is there a similar offer on Azure?</comment>


Is anyone else getting errors retrieving AWS IAM policies? - <AUTHOR> <comment><USER2> [https://status.aws.amazon.com/](https://status.aws.amazon.com/) IAM is global and is in issue state.

</comment><comment><USER3> I'm having issues getting access to AWS secret manager right now via CLI. I'm wondering if it is another DDOS attack against their DNS servers :(

</comment><comment><USER4> Lots of errors for different services. Looks like it's related to Disney+ launch failure.

<comment><USER4> [https://twitter.com/5kl/status/1194287830970834944/photo/1](https://twitter.com/5kl/status/1194287830970834944/photo/1)

</comment></comment><comment> k-ian us-east-1 is having issues, and IAM is run out of us-east-1

[https://status.aws.amazon.com/](https://status.aws.amazon.com/)

</comment><comment><USER5> Simple DB is having issues for me</comment>


Small application with big plans - <AUTHOR>

I have been a long time lurker to hacker news and have a side project that I think could use some feedback. Feel free to tear it apart, because that is exactly what it needs!
A few friends and I have built an app (QuickHap) for users to see what Events or Haps are happening right now in Toronto (we are expanding beyond this) and it also shows Events/Haps that will start within the next 12 hours. It lets you additionally post anything interesting happening, incase you wanted to share with other users. So its basically an easy was to discover cool things you might be missing out on.
So what I want is testers (you guys) to let me know how good (or bad) the app is. Any feedback is welcome :)
Here are the links for the app on iOS: https://itunes.apple.com/us/app/quickhap/id929848817 Android: https://play.google.com/store/apps/details?id=com.blk_inc.Haps Thank you for even taking the time to read this post :) If you want have problems let me know here or @QuickHap on twitter.
Thanks again! <comment><USER2> Downloaded, keep your eyes on this post. I'll comeback with feedback.

Toronto</comment>


Ask HN: Any ideas for mobile coupon validation? - <AUTHOR>

Hey everyone, I am working on designing an app that involves mobile coupons. Can anyone offer suggestions for how a coupon could be redeemed and tracked at retailers that don't have barcode scanners in place, aside from providing external hardware? Is POS integration feasible. Really appreciate the help. <comment><USER2> <http://www.promodigg.com>, refer to the FAQ of this site, you could find how to redeem a coupon.</comment>