How to Set Up a Linux Server on Amazon AWS

Abstract: AWS (Amazon Web Services) is one of the world's leading cloud server providers. You can set up a server in under a minute using the AWS platform. On AWS, you can fine-tune many technical details of your server, such as number of CPUs, memory and disk space, disk type (faster SSD or classic IDE), etc.

AWS (Amazon Web Services) is one of the world's leading cloud server providers. You can set up a server in under a minute using the AWS platform. On AWS, you can fine-tune many technical details of your server, such as number of CPUs, memory and disk space, disk type (faster SSD or classic IDE), etc. The best thing about AWS is that you only pay for the services you use. Before starting, AWS provides a special account called "Free Tier", you can use AWS technical services for one year for free, but there will be some small restrictions, for example, you can't use the server for more than 750 hours per month, If you exceed that, they will charge you. You can view all relevant rules on the aws official website.

Since this article of mine is about creating a Linux server on AWS, having a "Free Tier" account is a prerequisite. To register for an account, you can use this link. Note that you will need to enter your credit card details when creating your account.

Let's assume you have created a "Free Tier" account.

Before continuing, you must understand some terms in AWS to understand the setup:

EC2 (Elastic Compute Cloud): This term is used for virtual machines.
AMI (Amazon Machine Image): Represents an operating system instance.
EBS (Elastic Block Storage): A type of storage environment in AWS.
Sign in to the AWS console at https://console.aws.amazon.com/ .

The AWS console will look like this:

Amazon AWS console
Amazon AWS console

Setting up a Linux VM in AWS
1. Create an EC2 (Virtual Machine) instance: Before you start installing your system, you must create a virtual machine in AWS. To create a virtual machine, click on EC2 under the "Compute" menu:

Create an EC2 instance
Create an EC2 instance

2. Now click the "Launch Instance" button under Create instance.

Launch the EC2 instance
Launch the EC2 instance

3. Now, when you're using a "Free Tier" account, it's best to select the "Free Tier" radio button so that AWS can filter out instances that are free to use. This allows you to not pay for using AWS resources.

Select Free Tier instances only
Select Free Tier instances only

4. To proceed, select the following options:

a. Select an AMI (Amazon Machine Image) in the Classic Instance Wizard, then select Use Red Hat Enterprise Linux 7.2 (HVM), SSD Store

b. Select "t2.micro" as the instance details.

c. Configure Instance Details: Do not change anything, just click Next.

d. Add Storage: Don't change anything, just click Next, because at this point we will use the default 10 (GiB) hard drive.

e. Add Labels: Don't change anything just click Next.

f. Configure security group: Now choose port 22 for ssh so you can access this server from anywhere.

Configure AWS server
Configure AWS server

g. Select the Review and Launch button.

h. If all the details are correct, click the "Launch" button.

i. After clicking the "Launch" button, the system will pop up a window like the following to create a "key pair": select the option "create a new key pair" and give the key pair a name, Then download it. This key pair is required when connecting to the server using ssh. Finally, click the "Launch Instance" button.

Create Key pair
Create Key pair

j. After clicking the "Launch Instance" button, go to Services in the upper left corner. Select "Compute" --> "EC2". Now click on "Running Instances":

Go to the running EC2 instance
Go to the running EC2 instance

k. Now you can see that the status of your new VM is "running". Select the instance and note the "Public DNS name Public DNS" required to log in to the server.

Public DNS value of the VM
Public DNS value of the VM

Now you have finished creating a VM running Linux. To connect to the server, follow the steps below.

Connecting to an EC2 instance from Windows
1. First, you need to have putty gen and Putty exe for connecting to the server from Windows (or SSH command on Linux). You can download putty from the link below.

2. Now open putty gen: puttygen.exe.

3. You need to click the "Load" button, browse and select the key pair file (pem file) you downloaded from Amazon.

4. You need to select the "ssh2-RSA" option and click the Save Private Key button. Please select "yes" in the next popup.

5. Save the file with the extension .ppk.

6. Now you need to open putty.exe. Click "connect" in the left menu, then "SSH", then "Auth". You need to click the browse button to select the .ppk file we created in step 4.

7. Now click on the "session" menu and in "host name" paste the DNS value from step "k" in this tutorial and click the "open" button.

8. When asked for username and password, enter ec2-user and a blank password, then enter the following command.

$ sudo su -
lol, you are now the master on a Linux server hosted on the AWS cloud.

Logged in to AWS EC2 server

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326628921&siteId=291194637