host-server-aws

How to Host a Server on AWS

Hosting a server on AWS gives you full control over your computing environment. Whether you want to run a web server, game server, or backend service, Amazon EC2 allows you to do so with scalable virtual machines. 

This guide shows you how to launch and access a basic server on AWS.

How to host a server on AWS

Step 1: Sign in to the AWS Console

Enter your login details to access the AWS Management Console.

Step 2: Launch an EC2 instance

In the search bar, type EC2 and open the EC2 Dashboard, and launch the instance. Under Name, enter a name for your server (e.g., my-server) and choose an Amazon Machine Image (AMI).

Now, choose an instance type and create a new key pair or use an existing one under Key pair. If it’s a new pair, you’ll also need to download the .pem file.

Now, go to Network settings and allow SSH (port 22 for Linux) or RDP (port 3389 for Windows) and then click on Launch Instance.

Step 3: Connect to your server

Now, you need to connect to your server. The process will differ depending on the OS you’re using. Follow the respective steps below.

For Linux/Mac

Open your terminal, navigate to the folder where the .pem file is saved and change its permission using the following command:
chmod 400 my-key.pem

Now, connect using SSH:
ssh -i "my-key.pem" ec2-user@your-public-ip

You’ll get an output that looks something like this:

Welcome to Amazon Linux 2023

[ec2-user@ip-172-31-xx-xx ~]$

For Windows

Open Windows Terminal (or Command Prompt or PowerShell) and navigate to the folder where your .pem file is located. 

Now, run this command to set file permissions:

icacls my-key.pem /inheritance:r

icacls my-key.pem /grant:r "%username%:R"

Next, use the SSH command to connect to your instance. 

ssh -i "my-key.pem" ec2-user@your-public-ip

Step 4: Set up the server environment

Once you’re connected, you can install and start a web server. Once installed and running, your EC2 instance will serve as a default test page when accessed in a browser.

Step 5: View the server in your browser

Now, go to EC2 Dashboard > Instances, copy the Public IPv4 address of your instance and paste it in your browser to view and check it.



Pump saves ~60% on CLOUD *for free*

FAQ

Get started with PUMP for free

No contracts, no credit card needed to sign up

Get started with PUMP for free

No contracts, no credit card needed to sign up

Get started with PUMP for free

No contracts, no credit card needed to sign up

1390 Market Street, San Francisco, CA 94102

Made with

in San Francisco, CA

© All rights reserved. Pump Billing, Inc.