English Portuguese

Saving Money In The Cloud

If you ever started a side project or a startup and the costs depends solely on you, you'll probably agree with me that saving money is very important.

I started using Amazon AWS for servers and GitHub. The main reason was that I wanted to know more about the cutting edge stuff, but once I got the knowledge that I wanted, costs started to show up. Now I want to share with you my tips to keep the quality and save money:

1) Embrace Static Websites
If you're making a landing page, a blog, or any other website that could become static pages, turn them into static websites. Forget Wordpress, use Jekyll. Static websites are faster, cheaper and secure. You can upload your entire website to Amazon S3, pay a few dollars per month and serve your website from there! When combined with the s3_website gem, it becomes the state-of-art for static websites IMHO.

2) Activate Swap on your Instances
If you run out of memory, your server will crash and you'll probably want a more expensive server to deal with the traffic. However, if the workload isn't that much beyond your memory limit, you can use Swap to store what is beyond memory limit in the hard drive. It will become a bit slower, but saves you a lot of trouble. If your instance is SSD backed as Digital Ocean instances, you'll suffer less when reading from the hard drive.

At least in some Digital Ocean images, SWAP does not come activated by default. You need to enable it by using the following commands:

#!/bin/bash
# 3GB Swap, but you can change it, of course
# Usually set it between 3GB and 5GB sounds good
# As root, execute the following commands:
fallocate -l 3G /swapfile;
chmod 600 /swapfile;
mkswap /swapfile;
swapon /swapfile;
echo "/swapfile   none    swap    sw    0   0" >> /etc/fstab;

3) Move from GitHub to BitBucket
I was reluctant to change because the absence of 2 factor in there, but they implemented and I don't see a reason to don't move from GitHub to BitBucket as you can have unlimited private repositories. The cost starts to show up when you need more people to interact with your repositories, but until then, for small teams, is great. The logic is the following:

One more thing
As I mentioned Digital Ocean, I moved from AWS EC2 to there because of the instance pricing (in comparison to AWS EC2 On Demand) and because of their high quality support. And althought it lacks the AWS Ecosystem, I'm very happy with the change. If you want to try them and get 10 USD credit right off the bat, use this link https://www.digitalocean.com/?refcode=29f27a38d927.

Stay tuned! More posts are coming :)


Share the knowledge :)

Share on Twitter Share on Facebook Share on Google Plus Share on LinkedIn Share on Hacker News