Exploring Amazon EC2 Virtual Servers

Table of contents
Amazon EC2 (Elastic Compute Cloud) is a web service that provides on-demand, scalable computing capacity in the Amazon Web Services (AWS) cloud. It allows users to rent virtual machines, called "instances," to run their applications on AWS.
EC2 Types :
General purpose :
Great for a diversity of workload such as web servers or code repositories.
Balance between : Compute
Memory
Networking
For Lab, We will be using the t2.micro which is a General Purpose EC2 instance.
Compute Optimized :
Great for compute-intensive tasks that required high performance processors :
Batch processing workloads
Media transcoding
High performance web servers
High performance compute (HPC)
Scientific modeling and machine learning
Dedicated gaming server
Memory Optimized :
Fast performance for workloads that process large data sets in memory
Use cases : High performance, relational/non-relational database
Distributed web scale cache stores
In-memory database optimized for BI (business Intelligence)
Applications performing real-time processing of big unstructured data
Storage Optimized :
Great for storage-intensive tasks that require high, sequential read and write access to large data sets on local storage
Use cases : High frequency online transaction processing (OLTP) systems
Relational and NoSQL databases
Cache for in-memory databases
Data warehousing applications
Distributed file system
Accelerated computing :
specialized instances that include hardware accelerators like GPUs, FPGAs, or custom chips to handle demanding workloads more efficiently than standard EC2 instances.
Use case : Deep learning training
ML Inference
Video rendering/streaming
Custom hardware acceleration
Data Analytics acceleration
Introduction to security groups
Security groups are the fundamental of network security in AWS.
They control how traffic is allowed in to or out of our EC2 Instances.
Security groups only contain allow rules.
Security groups rules can reference by IP or by security groups.
Security groups are acting as a “firewall” on EC2 instances.
They regulate :
Access to ports
Authorised IP ranges -IPv4 and IPv6.
Control of inbound network (from network to the instance).
Control of outbound network (from the instance to other).
Can be attached to multiple instances.
Does live “outside” the EC2 if traffic is blocked the EC2 instance won’t se it.
It’s good to maintain one separated security group for SSH access.
All inbound traffic is blocked by default.
All outbound traffic is authorised by default.
How to Create an EC2 Instance in AWS (Step-by-step)
Log in to AWS Console.
Select the Region.
From AWS Management Console, Search “EC2”. (Navigate to the EC2 console).
Select launch Instance from the EC2 console dashboard.
Name and tags Give your instance a name. (Example : myfirstec2machine).
Application and OS Images (Amazon Machine Image)
For windows : Windows Microsoft
For Linux : Amazon Linux, Ubuntu, Red Hat, SUSE Linux, Debian. (Example : Amazon Linux)
Select AMI as per your requirements. (For Lab I am using free tier)
Instance type select as per your requirements. (free tier t2,t3 micro )
Key pair (login) Select an existing key pair or create a new one.
For new key pair :
Click Create new key pair
Give Key pair name ( EX : myfirstec2machine)
Key pair type Select RSA
Private key file format For windows machine : .pem (SSH access)
.ppk (putty access)
Create new key pair
Network settings Default settings are okay for testing.
Make sure SSH (port 22) is allowed if it's a Linux instance.
For web apps, allow HTTP (80) and HTTPS (443).
Configure storage Default: 8 GB
You can adjust size and type based on workload.
Review and Launch instance.
Wait a few seconds.
After that
How to connect through RDP Client
Select connect.
Select RDP Client.
Download remote desktop file.
Select get password. Upload private key file and Decrypt password.
Copy password and cancel.
How to login machine
Select Downloaded remote desktop file (EX : myfirstec2machine.rdp) After that Click connect paste the password you copied earlier and click yes. (1st way to connect)
Select Remote desktop connection on your machine give public IP and password that you copied Click connect Click yes.
How to connect through putty.
Copy Public IP
In your machine Download Putty and Open putty.
Host name (or IP address) paste copied IP.
Select path SSH/Auth/Credentials.
Private key file for authentication Select Browse.
Upload Private key click open click Accept.
Ubuntu login as : ubuntu
Amazon Linux machine login as : ec2-user
Ports uses :
22 = SSH (Secure shell) - Log into a Linux instance.
21 = FTP (File Transfer Protocol) - Upload files into a file share.
22 = SFTP (Secure File Transfer pro Protocol) - Upload files using SSH.
80 = HTTP - Access unsecured Websites.
443 = HTTPS - Access secured Websites.
3389 = RDP - (Remote desktop Protocol) Log into a window instance.
Here are a few common issues people run into :
Permission denied (public key/password) – Authentication problems.
Connection timed out – The server isn't reachable or port 22 is blocked.
Host key verification failed – The server's identity changed or the known hosts file has conflicts.
"Could not resolve hostname" – Typo in the hostname or wrong domain/IP.
"Connection refused" – SSH server might not be running or listening on the expected port.
Conclusion :
Amazon EC2 provides a versatile and scalable solution for deploying virtual servers in the cloud. With a variety of instance types tailored to different workloads, users can optimize their applications for performance, cost, and efficiency. The integration of security groups ensures robust network security, allowing for controlled access and data protection. By following the step-by-step guide to creating and connecting to an EC2 instance, users can effectively leverage AWS's powerful infrastructure to meet their computing needs. Whether for web hosting, data processing, or specialized computing tasks, Amazon EC2 offers the flexibility and resources necessary to support a wide range of applications.
Subscribe to my newsletter
Read articles from Tambadkar Rohit Yashwant directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Tambadkar Rohit Yashwant
Tambadkar Rohit Yashwant
Learning DevOps Engineer passionate about cloud computing, containerization, and automation. Currently exploring Docker, AWS, and CI/CD pipelines to build scalable and efficient workflows. Documenting my learning journey in blog. stay tuned with me for learning.