Getting a free server for Life
Sounds quite fake right! Even I thought so, but till now it seems to be real. I did signup for an Oracle Cloud account and currently you can get a server which you can keep for a lifetime. It says the lifetime of the account. It sounds questionable but lets see how long does this stay. I started yesterday but I heard that people have been using this server for years now.
So lets talk about what do you get for free. You can a 4 Core and 24GB memory server for free. Quite enticing! Also you can two 1 Core, 1 GB server for free. The first one is the Ampere platform which is basically ARM based architecture. If you aren't living under a rock then for sure you know that ARM based ones are quite capable and pretty much every manufacturer is moving towards that. The 2nd smaller ones are Intel based. So you can easily run a pretty hefty server cluster for free for life.
Now lets talk about how to setup one. Oracle guys are pretty strict about one person getting multiple accounts, so don't try from 20 different email addresses. You will also need a international payment enabled card. Start by going to Oracle Cloud Infrastructure's website, signup for a free account. You will need to give the details correctly but make sure you select the region as Mumbai region. The availability of Ampere servers are quite high in this region. There is also Hyderabad region but that doesn't give out free Ampere ones that often. You will get one though if you concern your account into Pay as you Go mode. For the mumbai region you don't need to convert or upgrade your account. The free version only gives the Ampere servers.
Now lets talk about the shape and size of the servers. Go to instances and create one. There do select Ubuntu aarch4 version of the OS, the regular ones are for x64 so they won't work.
Also under the shape of the server select Ampere A1 and then edit the CPU and make it 4. The RAM will automatically go to 24GB.
Once you click create it will automatically give you the server with all the details like public IP etc. Do not forget to download the private key that was created on the Instance creation page. PS: The boot volume allows 200GB per tenancy max. So I would suggest keep it around 50GB and create each instance. Otherwise if you push it to 200 then all your disk space will be gone for this tenancy.
Regarding setting up a basic website, Oracle Cloud also has similar to AWS VNCs, you will need to click on the Security Lists and add the ports like 80 or 443 to the Ingress Rules list.
Along with that you will also have to run these commands inside the server after you ssh into it to open up the ports from the instance:
sudo iptables -I INPUT -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
Change the port numbers to whatever you are interested in opening up. By default SSH /22 and ICMP ports are open.
Reclamation of Idle Compute Instances
Another important point is that Oracle keeps checking for idle instances, so by any chance if all of these criterion is met then your instance might be taken away. Oracle will deem virtual machine and bare metal compute instances as idle if, during a 7-day period, the following are true:
- CPU utilization for the 95th percentile is less than 20%
- Network utilization is less than 20%
- Memory utilization is less than 20% (applies to A1 shapes only)
This creates a problem if you just wanna keep a machine around handy for some dev work or just fancy a server for yourself. An easy workaround for the time being is to run some stress test software to generate fake load.
Objective is to achieve something like this so that there is some load but most of the system is free. I have been using stress command in Ubuntu to generate that and wrote a small script to keep it running in a loop.
while true; do
stress --cpu 1 --timeout 10s & cpulimit -l 20 -p $! && wait $!;
sleep $((10 + RANDOM % 21));
done
Then I use screen to run this so that it runs in background and keep running forever. You can then validate the utilisation by going to the Instances page of the OCI Dashboard
For further details about Free tier please go through this doc: https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier_topic-Always_Free_Resources.htm
Hopefully this will help you understand OCI and if you have questions, then reach out to me on Twitter. Enjoy free compute.