Amazon EC2: All You Need to Know

Amazon EC2 rents you a cloud server by the second. Learn the instance types, the ways to pay and what a small server costs each month.

Amazon EC2 T3 instance page on the AWS website
Screenshot: aws.amazon.com

Amazon EC2 (Elastic Compute Cloud) is the AWS service that rents you virtual servers, called instances, in Amazon data centers around the world. For a small website, app or test box, the usual answer is a t3.micro or t3.small on On-Demand pricing. These cost $7.59 or $15.26 for a full month of Linux use in US East. After that, you add a few dollars for disk space and a public IP address.

The sections that follow explain how EC2 works, how to read instance names and which of the five ways to pay fits your workload. They also cover the new free tier for fresh AWS accounts, the steps to launch a server and the side charges that catch first-time users.

How Amazon EC2 Works

An EC2 instance is a slice of a physical server that AWS runs for you. You pick the size, the operating system and the region, and AWS boots it in a minute or two. Then you log in over SSH (Linux) or Remote Desktop (Windows) and use it like any other machine.

AWS has run EC2 since August 2006, and the first instance type was the m1.small. Today the service has many instance types, grouped into six families. Because you rent by time, you can switch a server off when you do not need it and stop paying for the compute part.

Every instance needs a few other pieces to work. For example, it boots from an Amazon Machine Image (AMI). An AMI is a saved copy of an operating system such as Amazon Linux, Ubuntu or Windows Server. It stores files on an Elastic Block Store (EBS) volume, which acts as its hard drive. In addition, a security group acts as its firewall and decides which ports are open. So the server stays closed to the internet until you allow traffic in.

Billing is fine-grained. Linux instances bill in one-second steps, so a test server that runs for 20 minutes costs 20 minutes of time. As a result, EC2 is cheap for short jobs and can get expensive for servers left running by mistake.

EC2 Instance Types and How to Read Their Names

AWS groups its EC2 instance types into six families. As a result, each one tilts the mix of CPU, memory, disk and graphics chips toward a type of job.

FamilyLetters you seeBuilt forCurrent examples
General purposeM, T, MacWeb servers, small databases, mixed appsM7i, M8g, T3, T4g
Compute optimizedCBatch jobs, game servers, video encodingC7i, C8g
Memory optimizedR, X, U, zLarge databases and in-memory cachesR7i, R8g, X8g
Storage optimizedI, D, HFast local disks and big data storesI4i, I7i, D3
Accelerated computingP, G, Inf, TrnAI training, AI inference, graphicsP5, G6, Inf2, Trn2
High-performance computingHpcLarge science and engineering modelsHpc7a, Hpc8a

A name such as m7i.2xlarge has four parts. First, the letter “m” is the family. Next, the number “7” is the generation, and a higher number is newer. Then come option letters: “i” means Intel chips, “a” means AMD, “g” means AWS Graviton (Arm) chips and “d” means local NVMe disks. Finally, the size after the dot runs from nano and micro up to large, xlarge, 2xlarge and beyond.

Burstable, flex and fixed instances

T instances are burstable. For instance, a t3.micro has 2 vCPUs and 1 GiB of memory, but it only gets 10% of each vCPU as a steady baseline. It earns 12 CPU credits an hour while idle and spends them when traffic spikes. So a blog with light traffic runs fine on it, while a server that crunches numbers all day runs out of credits.

Flex instances, such as M7i-flex and C7i-flex, fall in the middle. They give a 40% CPU baseline and can burst to 100% for 95% of the time over a 24-hour window. On the other hand, fixed instances such as M7i give full CPU all the time, so they cost more per hour.

Amazon EC2 T3 instance sizes with vCPUs, memory and hourly price
Screenshot: aws.amazon.com

Amazon EC2 Pricing Options Compared

EC2 has five ways to pay for the same server. The cheaper options trade flexibility for a lower rate, so the right choice depends on how steady your usage is.

Pricing optionMost you can saveWhat you promiseCan AWS take it back?Who should pick it
On-DemandNo discountNothingNoNew projects and short tests
Compute Savings PlansUp to 66%A set dollar spend per hour for 1 or 3 yearsNoTeams that change instance types often
EC2 Instance Savings PlansUp to 72%Hourly spend on one family in one regionNoSteady servers that will not change
Reserved InstancesUp to 72%A set amount of capacity for 1 or 3 yearsNoOlder setups already built on them
Spot InstancesUp to 90%NothingYes, with a 2-minute warningJobs that can stop and restart

On-Demand is the default and the winner for anyone just starting out. You pay the list price, but you can stop at any second. Once a server has run steadily for a few months, a Savings Plan is usually the better deal. You can pay with nothing upfront, part upfront or all upfront. Paying part upfront earns a higher discount than paying nothing upfront.

Savings Plans work like a coupon on an hourly spend. For example, with a $50 an hour plan and $150 an hour of On-Demand use, the plan covers $100 worth of usage. You pay the $50 plan fee plus $50 at the normal rate, so the real discount works out to 50%.

Spot Instances are spare AWS capacity sold cheap. AWS can reclaim them with a two-minute warning, although on average they are interrupted less than 5% of the time. That makes Spot a good deal for video rendering, test suites and data jobs that save their progress. However, it is the wrong choice for a database or a single web server that must stay up.

Read also: ITIL Certification: All You Need to Know

What a Small EC2 Server Costs Per Month

T3 is the most common family for small workloads. In US East (N. Virginia), Linux On-Demand prices run from $0.0052 an hour for a t3.nano to $0.3341 an hour for a t3.2xlarge. Since a month has about 730 hours, you multiply the hourly rate by 730 to get the monthly bill for a server that never stops.

Monthly On-Demand cost of Amazon EC2 T3 instances running 730 hours on Linux in US East
Chart: Bizolaunch

Worked example: a small business website

For example, suppose you run a WordPress site on a t3.micro with a 20 GB gp3 disk and one public IP address. The monthly bill looks like this:

ItemRateMonthly cost
t3.micro instance, 730 hours$0.0104 per hour$7.59
Public IPv4 address, 730 hours$0.005 per hour$3.65
20 GB gp3 disk$0.08 per GB-month$1.60
Total$12.84

Notice that the IP address costs almost half as much as the server. AWS started charging $0.005 an hour for every public IPv4 address on February 1, 2024, even if it is not attached to anything. So an unused Elastic IP left in your account still costs about $3.65 a month.

If the same site grows and moves to a t3.small with a 30 GB disk, the total climbs to about $21.31 a month. Then a one-year Savings Plan becomes worth a look, because the server runs every hour of every day.

The AWS Free Tier for EC2 New Accounts

AWS changed its free tier on July 15 of last year. New accounts now get a $100 credit at sign-up and can earn up to $100 more by trying services in the Explore AWS panel. The free plan lasts up to six months, or until the credits run out, whichever comes first.

For accounts opened on or after that date, six EC2 types are free tier eligible: t3.micro, t3.small, t4g.micro, t4g.small, c7i-flex.large and m7i-flex.large. By contrast, older accounts keep the old 12-month offer on t2.micro and t3.micro.

However, read the rules for the end of the free plan. On the free plan, AWS suspends your account when the six months end. It then keeps your data for 90 days. If you do not upgrade to a paid plan in that window, AWS erases the account and its content. On the paid plan, you can also set a monthly spend limit from $20, with alerts at 50%, 75% and 90%. That helps students and side projects avoid a surprise bill. Read the AWS Free Tier FAQs before you rely on the credits for anything you need to keep.

How to Launch Your First EC2 Instance

The EC2 console launch screen fits on one page, so setup is quick. These steps set up a small Linux web server:

  1. Sign in to the AWS console and pick a region near your users, such as Mumbai (ap-south-1) for India or N. Virginia (us-east-1) for the US.
  2. Open EC2 and click Launch instance. Give the server a name.
  3. Choose an AMI. Amazon Linux and Ubuntu are both free to use.
  4. Choose the instance type. A t3.micro or t4g.micro is enough for a test site.
  5. Create a login pair for SSH and download the .pem file. AWS shows it only once, so store it safely.
  6. In network settings, allow SSH only from your own IP address. Also allow HTTP and HTTPS if the server will host a website.
  7. Set the disk size. Choose gp3, since it costs less per GB than gp2.
  8. Click Launch, wait for the status check to pass, then connect with SSH or EC2 Instance Connect.

After launch, set a billing alarm in the Billing console. In addition, tag every instance with a name and a project, because untagged servers are the ones people forget to stop.

Storage, IP Addresses and Other Charges Beside the Instance

The instance price is only part of the bill. In fact, three other items show up on most EC2 invoices.

First, EBS disks charge by size, with the server on or off. A gp3 volume costs $0.08 per GB-month and includes 3,000 IOPS and 125 MB/s of throughput at no extra cost. Older gp2 volumes cost $0.10 per GB-month, so moving from gp2 to gp3 cuts disk cost by a fifth. Snapshots, which are backups of a disk, cost $0.05 per GB-month in the standard tier.

Second, public IPv4 addresses cost $0.005 an hour each, as shown in the worked example. Using IPv6 or putting several servers behind one load balancer keeps this charge down.

Third, data that leaves AWS for the internet costs money after a free amount. The first 100 GB a month of data transfer out is free across all AWS regions except China and GovCloud. Also, that allowance no longer expires after 12 months. Traffic into AWS is free.

Stopping an instance ends the compute charge, but the disk and any Elastic IP keep billing. To stop all charges, terminate the instance and delete its leftover volumes and snapshots. For a wider plan on copies of your files, our data backup and recovery checklist covers what to keep and how often.

Read also: Amazon Office Buildings Around the World: HQ, HQ2 and Major Campuses

When Amazon EC2 Is the Wrong Choice

EC2 gives you full control of a server, so you also own the patching, backups and security updates. That is the right trade for developers and IT teams, but it is a poor match for some buyers.

For example, a shop owner who wants a basic WordPress site with no server work will spend less time on managed WordPress hosting. Likewise, code that runs for a few seconds when an event happens costs less on AWS Lambda, which bills per request. Resizing an uploaded photo is a common example. Teams that want to run containers without managing servers can look at AWS Fargate instead.

On the other hand, EC2 is the winner for steady workloads that need a specific operating system, custom software or GPUs. It also makes sense when you need exact CPU and memory sizes. Mixing On-Demand, Savings Plans and Spot to cut costs is another reason to pick it. If your site is slow on a small instance, check our website speed optimization checklist before you pay for a bigger server. Caching often fixes the problem for free.

Cloud spending also shapes the wider market. For instance, our report on Google Cloud revenue tracks how fast a rival cloud is growing. Companies can now even access quantum computers through the cloud.

Amazon EC2 Questions People Ask

Is Amazon EC2 the same as AWS?

No. AWS is the full cloud platform, and EC2 is one of its services. It is the service that rents out virtual servers, while other AWS services handle storage, databases and AI.

What is the difference between stopping and terminating an EC2 instance?

Stopping shuts the server down but keeps its disk, so you can start it again later. Terminating deletes the instance for good. By default, the root disk is deleted too.

Can I run Windows on EC2?

Yes. Windows Server AMIs are available, and the hourly price includes the Windows license. As a result, a Windows instance costs more per hour than the same size running Linux.

Which AWS region is cheapest for EC2?

US East (N. Virginia) is often among the cheapest, which is why AWS quotes its sample prices there. Still, pick a region near your users first, since a server on the far side of the world adds delay to every page load.

Do I pay for an EC2 instance when it is stopped?

You do not pay for compute time while it is stopped. However, you still pay for its EBS disks and for any public IPv4 address that stays reserved in your account.

Joydeep Bhattacharya Avatar

Written by

Founder, Editor and Business Reporter, Bizolaunch

Free Tools for Founders

Calculators and templates built by Bizolaunch. Run the numbers in minutes.

Keep Reading