How to build a server in AWS for close to a $1/month

Hey everyone,

Thought I would share some interesting findings I’ve had while working on a pet project. I’ve found a really interesting way to deploy very cheap servers on AWS, I thought some people may be interested in looking into this as a possible option.

Let’s start with some background. I recently upgraded some of my security cameras to newer models which support email notifications for intrusion detection. Because of this I needed to setup some type of mail service.

I started looking into a hosted mail service, because I didn’t want to go through the trouble of setting up and securing my own mail server. After some initial research I ended up using fastmail.

At the time after doing some research it seemed that setting up my own mail server which would have to include a static IP would probably run me around $10 to $20 dollars on various cloud providers. Fastmail was around$10/month so opted to go with them because the cost would essentially be very close to what I would end up paying to build my owner server, not including the time and effort I would have to put into deploying, securing and configuring my own server.

Fast mail was ok. The interface wasn’t very intuitive, but I got it working, and then after a while it just stopped working. I had no idea why. I went through a few iterations and after spending some time on it I decided I could have stood up my own server by now and it would be easier to troubleshoot and more flexible then fastmail. Additionally with my own mail server I wouldn’t run into any usage limitations that I would normally run into with any hosted service, for example you can only send 100 emails per hour etc.

This is when I started to look at hosting this on AWS for various reasons.

  1. AWS has very reasonable static IP pricing. Compared to other hosting providers having a dedicated elastic IP is pretty cheap on AWS. AWS charges $0.005 per IP / per hour. Which would total about $3.60 / month. And in some cases depending on how you use the elastic IP there is no charge.
  2. AWS has recently rolled out ARM instances which are much cheaper than x86 instance offerings
  3. AWS allows you to pay upfront for compute costs and save considerable amount of money. These are called reserved instances. You pay your bill upfront for a fixed term, commit to using a specific compute type but you save a lot of money in the process.

There’s also other benefits to AWS. I know other cloud providers have some of the same services but in AWS, you can easily encrypt your root volumes, and you can even do it with encryption keys that you own. It’s easy to take snapshot of the volume, and it’s very easy to take machine image of the entire machine for backup. Also I think the AWS IP space is generally more trusted then other cloud providers because I think they probably do a good job policing their environment. One final one is that AWS lets you easily manage network firewall rules through security groups, so I have a tightly controlled firewall rules to add an additional layer of security to my mail server.

I ended up deploying a t4g.nano arm instance type. The normal hourly cost for this is $0.0042. I decided to use the default AWS VPC so I don’t incur any additional costs for standing up a new VPC. I used a magnetic disk volume to keep my storage costs as low as possible. AWS allows you to pick between different storage types including magnetic disks, which are cheaper. I assigned a dedicated IP known as an elastic IP to my instance.

The operating system I used is amazon linux arm 64 bit o/s. From my understanding it’s based on redhat linux and I was able to find all the packages I needed with no differences from a centos configuration.

After a few weeks of testing, my mail server has been working great. So I decided to purchase a 3 year reserved instance. The total cost of this reservation for a t4g.nano is $41 up front. Which brings the monthly cost of compute resources for my server to approximately $1.14/month

The final state of things so far.

t4g.nano (with reserved instance pricing) - $1.14/month
Magnetic storage 2gb - $0.15 /month
Elastic IP (dedicated IP) - Currently not being charged, I believe it’s because I’m using the default VPC

The final total cost so far will be around $1.29/month.

The t4g.nano instance offers 2 vCPUs and 500MB of memory, which is more than enough to run postfix and some other tools I’m running on the server without issues.

Overall I’m happy with how things turned out.

Attached is a screenshot of the reserved instance I purchased and the EBS cost data from the AWS’s cost explorer:

$0.05 per 1 million I/O requests - US East (Northern Virginia)
$0.05 per GB-month of Magnetic provisioned storage - US East (Northern Virginia)

13 Likes

I have found that this tends to hold for other places as well, at my VPS host I have a yearly plan that is %20 of the cost of the monthly plan, and have in the past had similar (although not as good) price drops for signing up for a long term plans.

Are you sure about that? I used the AWS calculator and it showed me a upfront cost of around 44.68USD for 3 years for the instance and a monthly cost of 112.64 USD for 2TB of EBS magnetic storage.

@Sapiens Yes I am sure. I had a typo in my original post. I specified 2tb instead of 2gb as the volume size. I’ve gone back and fixed the typo and added some additional data.

Also, the AWS cost calculator probably gives good estimates but might be off by a bit. What I’m reporting is the actual cost directly from cost explorer which is what I’m actually getting billed for.

lol I was about to say 2TB for $0.15 /month is pretty good

1 Like

I wouldn’t be surprised if storage per byte were costing hyperscalers like aws or microsoft or google $0.15/TiB/month.

I don’t want to bore you with details, but a friend and me were working on a cookie cutter for a business plan for cloud backup services where it’s cheaper to buy storage than host it in your home (even if power/server/network were free at home). On top of that, hyperscalers probably get HDDs at 30% MSRP, or lower straight from the factories and can afford the human sacrifice to run software and hardware at scale with low overhead erasure codes.

My face when I read this and realized that I overpaid for such a service almost five times more because I did not think to do it myself.