I am a great fan of cloud hosting as it gives me ease and control to manage my own production environment as per my need. Luckily, Amazon Web Services (AWS) offers “AWS Free Tier” by using which we can get hands-on experience with AWS Cloud Services at no charge for 12 months. So, I took the chance to test drive their services. Today I am going to write about launching and preparing my first instance on Amazon EC2 service where we will host a web application developed using PHP (Laravel 5.1).
First, we will need to login to our AWS Management Console and select EC2. We will see a dashboard like below:
You can see lots of options there. But to launch our first instance, click on the blue “Launch Instance” button. You will then be prompted to choose an AMI to launch your instance. An AMI is a template that contains the software configuration (operating system, application server, and applications) required to launch your instance.
I am going to select Ubuntu Server 14.04 LTS for on our instance and luckily it’s eligible to use with AWS Free Tier.
Next, we will need to select our instance type. We will choose t1.micro type instance this time as our AMI is eligible to run on this instance and free tier is only eligible for micro instances. If you are ready to afford some money to get more powerful instance, you can choose any other instance that fits you the best.
On the next step, you can configure instance details as per your need . But I will keep the default configuration for now and move on to the next step.
Then we will need to add storage to our instance. Free tier eligible customers can get up to 30 GB of EBS General Purpose (SSD) or Magnetic storage. For now, I will add an EBS General Purpose (SSD) and allocate 20 GB of space and uncheck the “Delete on Termination” option so that my data remains available even after the termination of the associated instance.
Next, we can add tag to our instance. If you are confused about what this is all about, go through this: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html
Then we will need to configure security group set firewall rules that control the traffic for our instance. For now, I am going to select the existing security group which will allow all traffic to access my instance. But for better security, you may modify these rules to prevent unauthorized access. Then click on “Review and Launch“. All the details of your instance will be shown. If needed you can make necessary changes, otherwise click on the “Launch” button.
Next, you will be able to create e new key pair which you will need to login to your instance. Give the key pair a name, download the Key Pair (.pem) file and click “Launch Instances“. Please keep in mind that you have to download the private key file (*.pem file) before you can continue. Store it in a secure and accessible location. You will not be able to download the file again after it’s created.
It will take some time to complete the instance launching process. After that, you will see a page with Launch Status of your instance. Voila! You are ready with your first Amazon EC2 instance now
If you visit the “Instances” section now, you will see that your running instance is listed there. On our next part, we will connect with our newly created instance via SSH and install the necessary software to run a web server.
Note: If you are looking for a paid cloud hosting provider, I would recommend Digital Ocean (affiliate link, will give you 10$ referral credit) which is being used to host this website. and I am pretty much happy with their service.