Hello, everyone, I am Shashikant Dwivedi and in this article, I’m going to demonstrate, how you can create your own Linux server using AWS.
If you know what AWS is then it's good and if you don’t know about what AWS is then here is a general intro of AWS for you.
AWS — It is a cloud service provider. That provides you with a large number of cloud services like computing, storage, database, networking, etc. online.
Before heading forward there is a pre-requisite that you must have.
An AWS account (Must be under free tier, if you want your server created for free).
So if you have an AWS account, then log in and open the AWS console.
- On the AWS management console search for EC2 and open it.
2. Now on the EC2 dashboard click on the Launch Instance button.
3. Now on choose AMI window select Ubuntu Server 20.04 LTS (HVM).
So here we are selecting Ubuntu Server. You can select any other Linux distro server according to your convenience. And remember, if you want your server under the free tier, then select only those servers in which the label of free-tier eligible is there.
4. Now on Choose Instance type window select t2.micro as it is free tier eligible and click on the Next: Configure Instance Details button.
Instance Types represent the different-different system configurations. So choose according to your requirements. But remember if you want your server under the free tier use instance type with the free-tier tag only.
5. Now on Configure Instance window leave it as it is and click on the Next: Add Storage button
You don’t need to disturb these settings.
6. Now on Add Storage window, you can change storage up to 30 GB as it is free tier eligible and then click on the Next: Add Tags button.
You can add storage according to your use.
7. You can leave add Tags window default as it is not needed that much and click on the Next: Configure Security Groups button.
You can add tags to a server, to categorize them.
8. Now on the Configure Security Group window change the ssh source to anywhere to access it from anywhere in the world. You can also restrict ssh access to your IP address from the source option. After that click on the Review and Launch button.
Ok talking about security groups. It is one most important settings because it decides your server's openness to the world. You want to host your web application on the server that you also have to allow HTTP and HTTPS in security groups.
9. In the Review window you can see all details related to the server that you are going to launch. Now press the Launch button.
Now just preview all the configurations of your server before the final launch.
10. Key pair is used to connect to your server or if I say your EC2 instance. So you can select the option Create a new key pair and give that key pair a name and click on the checkbox and firstly download the key pair and then click on the Launch Instances button.
11. Finally, your server has been launched. Now click on the View Instance button.
12. Now place your downloaded private key file or key pair into a safe location and open the terminal on that location. After opening the terminal restrict access to the private key file by change mode command
chmod 400 key_filename.pem
13. Now open your Instances window again and see if Instance State is running or not. If the Instance state is running then copy the IPv4 Public IP and open the terminal again in the same location. And types this command to connect to your Ubuntu server
ssh -i key_filename.pem user-name@your-server-ip
In the Ubuntu server by default, the username is ‘ubuntu’ so your command will be
ssh -i key_filename.pem ubuntu@your-server-ip
14. Now if asked for yes or no type yes.
15. Now finally you are connected to your ubuntu server.
16. You can type ‘exit’ to disconnect for the server and if you want to close the server permanently go to Instances on AWS management console and select the server, and then press the Actions button in which press on Instance State in which press Terminate.
And that’s it. This is how you can create a Linux server on AWS.
Hope you have liked the article. And if you have any problems, you can ask me in the comment section.