Day 2 Of 30 AWS: Setting Up First Server On AWS

What is IP Address?
An IP address, or Internet Protocol address, is a unique string of numbers assigned to each device connected to a computer network that uses the Internet Protocol for communication. It serves as an identifier that allows devices to send and receive data over the network, ensuring that this data reaches the correct destination.
Types Of IP address
IPv4
This is the most common form of IP Address. It consists of four sets of numbers separated by dots. For example, 192.158.1.38. Each set of numbers can range from 0 to 255. This format can support over 4 billion unique addresses. Here's how the structure is broken down
Four Octets: Each octet represents eight bits, or a byte, and can take a value from 0 to 255. This range is derived from the possible combinations of eight bits (2^8 = 256 combinations).
Example of IPv4 Address: 192.168.1.1
192 is the first octet
168 is the second octet
1 is the third octet
1 is the fourth octet
Each part of the IP address can indicate various aspects of the network configuration, from the network itself to the specific device within that network. In most cases, the network part of the address is represented by the first one to three octets, while the remaining section identifies the host
IPv4 Address Format
185 . 107 . 80 . 231
| Octet | | Octet | | Octet | | Octet |
Binary Representation: 10111001 . 01101011 . 01010000 . 11100111
Each octet = 1 byte = 8 bits Total: 4 bytes = 32 bits
IPV 6
IPv6 was created to replace IPv4 because we were running out of IP addresses. Unlike IPv4, which uses 32 bits, IPv6 uses 128 bits, allowing for a much larger number of addresses. An IPv6 address is written as eight groups of four hexadecimal numbers, separated by colons (:
).
Each group (like 2001
, 0db8
, 85a3
, etc.) represents 16 bits of the total address.
Example:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
What is Server?
A server is a special computer that stores and shares information or services with other computers.
Why Do We Use and Need Servers?
Open websites (Google, YouTube, etc.)
Send and receive emails
Store and access files
Run apps like games, banking, or shopping
Use cloud services (like AWS, Google Cloud)
Why are Servers Important?
- Without servers, there would be no internet, no websites, no apps.
They help us connect, share, and work online.
Elastic IP
An Elastic IP is a permanent public IP address that you can use for your EC2 server in AWS.
Why We Use Elastic IP
To have a fixed address to access your server.
So your website or app is always reachable at the same IP.
You can move it to another server if needed.
You get 1 free Elastic IP (only if it's being used).
AWS charges you if you reserve it but don’t attach it to anything.
What is an EC2 Instance?
An EC2 instance is a virtual computer you can create and use on the internet using AWS. EC2 stands for Elastic Compute Cloud.
Why We Use It
To run websites and apps
To practice coding
To store data
To use a computer from anywhere
What is the PEM file or Key file used for when creating an EC2 instance?
When you create (launch) an EC2 instance, AWS asks you to create or choose a key pair.
This key pair gives you a PEM file which is your private key.
Why Do You Need It?
It’s used to log in securely to your EC2 instance using SSH.
Without it, you can’t access your instance from your computer.
It protects your server so that only you can log in.
How You Use It
After the instance is created, you run a command like this in your terminal:
ssh -i my-key.pem ec2-user@your-instance-ip
Download the PEM file once and keep it safe AWS won’t let you download it again!
If you lose it, you can’t connect to your EC2 instance.
Keep it private and set permissions
Security Groups
An AWS Security Group is like a firewall for your EC2 instance.
It controls who can connect to your server and what they can do.
Why We Use Security Groups
To protect your instance from unwanted access
To allow only trusted traffic
To open specific ports for specific tasks (like port 22 for SSH, 80 for websites)
How It Works:
You set inbound rules and outbound rules
Rule Type | What It Does |
Inbound | Controls what traffic comes in (e.g., allow port 22 for SSH) |
Outbound | Controls what traffic goes out (usually open by default) |
Common AWS Port Rules (Inbound)
Port | Protocol | Use For | Description |
22 | TCP | SSH (Linux login) | Needed to connect to Linux EC2 using terminal and .pem file |
3389 | TCP | RDP (Windows login) | Needed to connect to Windows EC2 using Remote Desktop |
80 | TCP | HTTP (Web traffic) | For regular websites (http://) |
443 | TCP | HTTPS (Secure web traffic) | For secure websites (https://) |
3306 | TCP | MySQL Database | If you're running a MySQL server |
5432 | TCP | PostgreSQL Database | If you're running PostgreSQL |
3000 / 8080 | TCP | Custom web apps | For Node.js, React, or other custom apps |
- Outbound rules are usually open by default in AWS (allowing all traffic out).
You can restrict them if you want more control and security.
Steps to Launch Your First EC2 Instance
1. Go to EC2 Dashboard
Login to AWS → Search for EC2 in the search bar.
Click on EC2 → Click “Launch instance”.
2. Name Your Instance
- Give your instance a name (e.g., myfirstinstance)
3. Choose AMI (Operating System)
Choose Amazon Linux 2 or Ubuntu (free tier eligible)
4. Choose Instance Type
Pick t2.micro → (Free tier eligible and good for beginners)
5. Create or Choose a Key Pair (PEM File)
If you don’t have a key pair:
Click Create new key pair
Name it something like
my-key
Choose .pem
Click Download key pair and save it safely on your PC
You’ll use this file later to log in to your instance
6. Set Security Group (Firewall Rules)
Create a new security group:
Allow SSH (port 22) → Source: My IP (recommended)
Allow HTTP (port 80) if you're hosting a website
This decides who can access your instance
7. Launch the Instance
Review settings → Click Launch Instance
Wait a few seconds
8. Connect to the Instance
Go to Instances → Select your instance
Click Connect
Conclusion of Today’s AWS Learning
AWS Security Groups & Ports
Security Group is like a firewall that protects your server.
It controls who can access your EC2 instance and on which ports.
Important ports to remember:
22 – for SSH (to log in to Linux)
80 – for websites (HTTP)
443 – for secure websites (HTTPS)
Always limit SSH to your IP for safety
Launching an EC2 Instance:
EC2 is like a computer in the cloud.
You can choose the OS, size, and setup.
You need a PEM/key file to connect it’s your secret key.
After launching
You can log in using SSH.
Start using it like a normal server (host a site, run code, etc.)
IP Address And Elastic IP
An IP address is like your server’s home address on the internet.
There are two types:
IPv4 – Common, shorter (like
192.168.1.1
)IPv6 – Newer, longer, supports more devices
An Elastic IP is a permanent public IP that you can attach to your EC2 instance, so it doesn’t change.
Subscribe to my newsletter
Read articles from Prajakta Vadje directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
