Aws

How to make the most of the AWS free tier

Ten tips for stretching Amazon’s free services to the limit and keeping your cloud bill near zero
Pro
Image: AWS

19 October 2020

Amazon and the other cloud services offer hundreds of different ways to try out their products. New products are born, tested, poked, and prodded for only the cost of the developer’s time. If the code makes it big and starts generating enough revenue, the developers can grow into paying customers. If it doesn’t and they don’t, at least the developers will become comfortable with the tools and probably turn to Amazon for the next project.

The AWS free tier is not just for students. Sometimes asking the boss for a budget line, no matter how small, means triggering a series of questions and meetings that demand explanations. A number of good developers test their plans on free machines because it’s much more impressive to present a running prototype than a slide deck with some mockups.

Amazon offers three different kinds of free services. Some are short-term samples, allowing you to evaluate a new service for a month or so. They’re meant to get teams to explore new products. Others are like a generous welcome wagon for new developers who sign up for an AWS account.

 

advertisement



 

The most generous are the ‘always free’ offerings that keep going and going. Some developers make it a point to build their products to live in the free tier as long as possible. It’s a bit of a game because development resources aren’t too expensive at first, but this focus on the bottom line can produce good applications that are cleanly engineered to use a minimum of AWS’s resources. When they scale, the bills will scale a bit more slowly.

Here are 10 suggestions for how to play the AWS stack and generate the smallest bills using the freest of services.

Waste not want not

Most of the AWS services in the free tier come with a limit, usually enforced each month. Some of these seem impossibly large like AWS Lambda’s grant of one million function calls. After you’re finished paying homage to Dr Evil from the Austin Powers movies by echoing his pronunciation of ‘million,’ you can start budgeting your use of these function calls to the most important jobs. Even the generous limits can be exhausted. A million can come pretty soon if you’re not careful.

Go static

The options for computation in the free tier are pretty limited and so it pays to reduce the server-side computation as much as possible. Static site generators like Jekyl or Gatsby turn the data in your dynamic website into HTML, JavaScript, and CSS files that sit out in a static Web server. Perhaps you’ll move them to a CDN like Amazon’s CloudFront. Perhaps you’ll serve them directly from Amazon S3. Perhaps you’ll even park them in the corner of another server around your office. The point is to save computational resources that would be generating your Web pages dynamically so you can stay within the free tier.

Go serverless

AWS Lambda is the only Amazon compute option that remains free after one year. It’s also arguably the best option for a service that will scale smoothly to handle thousands, millions, or billions of requests. Choosing Lambda from the beginning sets your application up for success in the future.

Go NoSQL

Amazon also encourages us to use their DynamoDB by including 20Gb of storage space that’s always free. DynamoDB may not offer the same clever indexing and normalisation options that relational database lovers have embraced over the years, but NoSQL remains a smart and flexible architectural choice that’s especially forgiving for evolving prototypes and pivoting start-ups.

Combine AJAX calls

Sometimes you’re going to need to make your site interactive. The best approach is to bundle the calls to your web services into as few transactions as possible. The Amazon API Gateway free tier, for instance, includes one million API calls and one million HTTP calls. Bundling all of your data into one call makes these limits last longer than dutifully invoking the calls immediately. The simplest way to accomplish this is to cut back on storing documents or form data for the user. Yes, this can make the service a bit less robust and crash resistant, but that’s the cost of doing things for free.

Empower the client

While cookies and their lesser known cousins like the local Web Storage API have a reputation for helping big business track people, they also offer the opportunity for users to control their privacy by storing their local data. It also makes it easier to build a free tier web application by offloading the cost of storing client data on the client’s own machine. The users’ machines store the data so you don’t have to.

More privacy and less central costs. It would be a perfect solution if it weren’t for the total catastrophe that follows a lost phone, a crashed local disk, or any of a million other failures. It’s best to use this for casual data, not mission-critical information.

Avoid gimmicks

Some websites have added flashy interactive features like autocomplete. These may be fun and they may generate attention, but each of these features usually requires another request to the cloud and that eats into your limit. Avoiding unnecessary moving parts is the simplest way to save compute resources.

Run your own database

The Amazon-managed relational database services like MySQL or PostgreSQL are great tools for starting up and maintaining a database to hold your app’s information, but the free tier only offers you one of them and it’s only for the first 12 months. There’s nothing stopping you from running your own database on one of the free EC2 instances that are also available for the first 12 months. Yes, you’ll need to install them and configure them yourself, but it will double your database options.

Log carefully

All of the free storage at AWS comes with limits. Good developers create good log files to debug problems and catch failures, but most log files are never used. Staying within the limits for storage is simpler if you clean out your logs frequently. Some just throw away the data and some download it to their desktop disk.

Use non-cloud resources

It’s not exactly a fair answer to say that you can get more out of the free tier by running your own server back on your desk. Still, some judicious use of non-AWS services can really stretch the work being done on the cloud. Database backups, for instance, could move to your desktop, which might have several terabytes of empty space waiting for some of the random detritus. And you’re probably going to want to back up your projects outside of the cloud anyway. Any service or data that doesn’t need the immediate response and constant uptime of the cloud is fair game.

Recognise the limits

The free tier is an excellent way to explore AWS and it’s fun to strip away all of the extraneous features to try to generate bills for €0.00, but at the end of the day AWS is a business and the free tier is a well-designed marketing tool not a public charity. Some people openly create new accounts with new e-mail addresses to continue to restart the 12 month clock. This may work with disposable projects but not with those that have started attracting users that will be disrupted when you switch accounts.

When your creations have found an audience, it’s time to start finding a way to pay the bills. The good news is that all of the lessons you’ve learned from living in the free tier will keep your bills much lower. The API Gateway, for instance, charges just little for a million invocations. If you’ve been successfully running in the free tier, then your bills won’t be more than a few euro a month.

That should hold until everything goes insanely viral and your outrageous good fortune makes the AWS bill the least of your worries.

IDG News Service

Read More:


Back to Top ↑

TechCentral.ie