CloudBerry Lab Resources
Get started with cloud backup and management solutions
AWS Free TIer EC2

How You Can Use AWS Free Tier — Cloud Compute

Published: by on Post Type: Categories: AWS

Cloud computing has triggered a sea change in how application development is done. Amazon Web Services, or AWS, is the leader in the cloud computing space and provides computing infrastructure for many of the largest companies in the world.

The best way to learn a new technology is to use it. Luckily, AWS has a free tier that allows you to try out its services without forking over any money upfront. In this post, we will discuss the free tier option for some of the AWS compute services. We will discuss Elastic Compute Cloud (“EC2”) and AWS Lambda. For each service, we will cover what it is and what the free tier covers. We’ll also review a sample project you could use to get started.

Table of Contents

    What Is Amazon Elastic Compute Cloud (EC2)?

    Amazon EC2 is a general-purpose compute service from AWS. It allows you to spin up instances, which are virtual machines configured with different amounts of CPUs, memory, disk storage, and network capacity. You have full-access to these virtual machines, whether by using SSH for a Linux-based instance or RDP for a Windows-based instance.

    EC2 is the core building block for many cloud-native operations due to its flexibility. If you’re building .NET applications, you can run your application with IIS on Windows-based EC2 instances. If you’re building applications with Python & Django or NodeJS and Express, you can run them on Linux-based EC2 instances. You can use EC2 to host your databases, such as SQL Server, MySQL, or Postgres, or you can host your own email infrastructure with Postfix.

    Amazon EC2’s power is in its flexibility and simplicity. You have the power to spin up virtually any amount of compute in seconds. Over time, AWS has increased the flexibility of EC2. For example, you are able to create an EC2 instance from an Amazon Machine Image, or “AMI” for short. AWS provides a number of standard AMIs for you to use, such as various versions of Ubuntu, CentOS, RHEL, Windows, and more.

    Further, AWS has an AMI marketplace where you can purchase pre-configured images for a variety of use cases. Finally, AWS allows you to create your own AMIs, leading to the popularity of the “immutable infrastructure” pattern. With immutable infrastructure, you create a new AMI whenever you have a new version of your application. If you need to create additional EC2 instances, you use the latest AMI that is ready to go, rather than creating a new instance and running complex configuration steps to get the latest software on it.

    When creating an Amazon EC2 instance, you will choose an instance type and an instance size. An instance type is a family of instances with CPU, memory, networking, and disk capacity that satisfy certain use cases. For example, certain instance types, like the R5 instances, are memory-optimized and are perfect for online databases. Other instance types, like the C5 instances, are compute-optimized and work well for video processing workflows.

    Once you’ve chosen an instance type, you then choose an instance size within the type. For example, the aforementioned C5 family ranges from the c5.large with 2 CPUs and 4 GB of RAM up to the c5d.18xlarge with a whopping 72 CPUs and 144 GB of RAM.

    For more information on EC2 instance types, check out our previous article on Choosing the EC2 instance type that is right for you.

    Amazon EC2 Billing and Free Tier

    Amazon EC2 has a flexible billing system. The default method of payment is On Demand -- you are charged an hourly rate for your EC2 instance based on the operating system and the instance type and size that you choose. For most operating systems, instance use is billed by the hour and rounded up. If you create a new instance and terminate it one minute later, you will be billed for the whole hour. In 2017, AWS announced per-second billing for EC2 instances if they are running Ubuntu or Amazon Linux (a CentOS-flavored distro maintained by AWS directly).

    The Free Tier for Amazon EC2 allows you to run two EC2 instances -- one Linux, one Windows -- each month for a full month. For each operating system, you get 750 hours of a t2.micro instance. A 31-day month has 744 hours, so you’ll be safe to keep each instance running constantly the entire month. A t2.micro instance has 1 GB of RAM and 1 virtual CPU, so it can’t handle a ton of traffic. It’s great for low-usage services and internal tools.

    Note that the EC2 Free Tier is only available for the first 12 months after your account is created.

    If you want to run web applications, the Amazon EC2 Free Tier also includes 750 hours per month of the AWS Elastic Load Balancing service. This is a great service for balancing your web traffic across multiple EC2 instances without having to run your own Nginx, Apache, HAProxy, or other tool. Like the EC2 Free Tier, the Elastic Load Balancing Free Tier is only valid for the first 12 months after your account is created.

    When provisioning your EC2 instance in the AWS console, it shows that the t2.micro instance is free tier eligible:

    AWS Console Free Tier EC2

    Example Projects with Amazon EC2 Free Tier

    Amazon EC2 is a flexible service that can be used for nearly any use case. The most common use cases are serving web applications, running worker pools for queue processing, or hosting internal tooling. Check out the examples below for some ways to get started.

    Web Servers on EC2

    If you’re making a web application, you’ll need a place to serve web requests. EC2 is a common choice for hosting your web applications.

    Here are a few guides:

    Queue Processing

    Using a queue and processing it with workers is a common pattern in software development. Due to EC2’s flexible scaling capabilities, it is a common tool for managing your worker pools.

    Here are some resources on using worker pools with EC2:

    Internal Tools

    Business often needs to run internal software, such as a mail server or Jenkins for building applications. EC2 is a great choice for this.

    Check out these walkthroughs:

    What Is AWS Lambda?

    AWS Lambda is a Functions-as-a-Service (FaaS) offering from AWS. It was announced at re:Invent, the AWS developer conference, in 2014. Lambda ignited the “serverless” computing movement. With Lambda, you don’t have a long-running server instance that’s always on, waiting to respond to requests. Rather, you upload small bits of code that AWS will manage for you entirely.

    There are four unique aspects of AWS Lambda as compared to traditional, server-based compute:

    • Event-driven: Your code is not constantly running, like on an EC2 instance. Rather, your code is only running when a specified event happens. When your code is done responding to the event, it will stop running.
    • Zero administration: You are not responsible for managing your server hardware or upgrading the underlying software packages on your machine, such as upgrading the kernel in the event of a severe bug. AWS handles all of this for you.
    • Auto-scaling: AWS will run as many or as few instances of your function code as is necessary to handle the events coming in. You don’t need to pre-provision instances in anticipation of huge traffic.

    Pay-per-use: You pay based on the amount of time your code runs. You will only pay when your code is responding to events, which means you don’t pay for idle like you would with EC2.

    The event-driven aspect is particularly novel and worth discussing further. With Lambda, you upload a zip file containing your function code and tell AWS the entry point file and function in your zip file. AWS will manage running your function code in response to a specific event trigger, such as an HTTP request or the creation of a new object on Amazon S3, object storage by AWS.

    AWS Lambda has 19 supported event triggers, and they’re adding more all the time. This event-driven compute allows you to build powerful workflows that respond dynamically within your application.

    AWS Lambda Billing and Free Tier

    Lambda has a pay-per-use billing system. You do not pay for your code sitting idle, waiting to respond to a request. You only pay when your code is live and performing work to respond to an event trigger.

    Lambda is billed on two axes:

    • Requests: $0.20 per 1 million invocations. Thus, each time your function runs, you pay $0.0000002
    • Duration: $0.00001667 per GB-second of compute

    The duration calculation can be confusing, so let’s walk through that. When configuring your Lambda function, you will specify the amount of memory you want to allocate to the function. This can be as low as 128 MB for very simple functions up to 3 GB for data-intensive functions.

    Duration is calculated as a function of the configured memory and the length of time your function runs. The calculation is as follows:

    GB-seconds = Total seconds X (Configured Memory / 1024)

    First, sum up the total amount your function ran across all invocations. Then, turn your configured memory into fraction of one gigabyte. If you ran at the lowest memory setting, your GB-seconds would be one-eighth of your actual seconds (128 / 1024). If you ran at the highest memory setting, your GB-seconds would be nearly three times your actual seconds (3008 / 1024).

    Once you have determined your GB-seconds, multiply it by $0.00001667 to find your actual duration cost for your function.

    AWS has a generous free tier for Lambda, and the Lambda free tier never goes away. Unlike the EC2 free tier, which expires 12 months after account signup, you can use the benefits of the Lambda free tier in perpetuity.

    The free tier for Lambda includes 1 million requests per month and 400,000 GB-seconds of compute per month. This would cost you just under $7 a month without the free tier.

    This free tier can cover a wide variety of use cases. Check out the example projects to see how you can get started with AWS Lambda.

    Example Projects with Lambda Free Tier

    AWS Lambda is used for a variety of tasks, from web APIs to image processing to DevOps automation and more. Below are a few example projects to get you going.

    AWS Lambda is used for a variety of tasks, from web APIs to image processing to DevOps automation and more. Below are a few example projects to get you going.

    Configuring Lambda can be difficult, so it’s best to use some type of deployment framework when orchestrating your Lambda functions.

    Web APIs with AWS Lambda

    You can use AWS API Gateway to connect your Lambda functions to HTTP requests. This is a very popular use case for setting up REST APIs, GraphQL APIs, or responding to webhook events from SaaS providers.

    Like Lambda, API Gateway has a free tier. Your first million requests per month are free. After that, requests are charged at $3.5 per million requests.

    Here are some links to get you started:

    DevOps Automation Tasks

    If you’re already an AWS user, Lambda is a great way to extend the functionality of AWS to accomplish some automation tasks. Lambda allows you to schedule the invocation of your Lambda functions. This is a great replacement for regular tasks that you used to schedule with cron on a server. For example, you may want to take daily backups of your EBS volumes or check your S3 buckets to make sure they’re not publicly available.

    Additionally, you can use Lambda to react to CloudTrail events. AWS CloudTrail is a service that tracks the API actions that happen in your AWS account. You can use this as an audit log of actions to see who created what resources and when. By tying into Lambda, you can send proactive notifications when undesirable behavior happens.

    Here are a few examples to look at:


    In this post, we discussed two of the main compute options on AWS: the traditional server option with Amazon EC2 and the newer, serverless model with Lambda. You learned the billing model of both services as well as what is covered by AWS’s free tier. Finally, we provided some example projects to get started with EC2 and Lambda.

    Alex DeBrie avatarAuthor
    Alex DeBrie (@alexbdebrie)
    A software developer with a background in data engineering and cloud infrastructure management. He has deep experience with AWS and is a proponent of infrastructure as code. In his free time, he likes running and spending time with his wife and four kids. View all posts
    Published: by on Post Type: Categories: AWS
    1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)