Create and Connect to an AWS EC2 Instance

Table of contents
- Major Uses of AWS EC2
- Prerequisites
- Step 1: Sign in to AWS Management Console
- Step 2: Launch an EC2 Instance
- Step 3: Choose an Amazon Machine Image (AMI)
- Step 4: Choose an Instance Type
- Step 5: Choose Key pair Details
- Step 6: Configure Network Settings
- Step 7: Add Storage
- Step 8: Review and Launch
- Step 9: Successfully EC2 is created
- Step 10: Connect to Your EC2 Instance
- Conclusion

Amazon Elastic Compute Cloud (EC2) is a fundamental service in AWS that allows users to launch and manage virtual servers in the cloud. In this guide, we will walk through the step-by-step process of creating an AWS EC2 instance.
Major Uses of AWS EC2
AWS EC2 provides scalable computing capacity in the cloud, enabling users to build and deploy applications efficiently. Some major uses include:
Hosting Websites and Applications: Deploy and manage web applications, APIs, and backend services.
Gaming Servers: Host multiplayer game servers with high performance and scalability.
Development and Testing: Create virtual environments for software development and testing.
Containerized Applications: Run Docker and Kubernetes workloads efficiently.
Big Data Processing: Run data analytics, machine learning models, and batch processing jobs.
Disaster Recovery: Implement backup and recovery solutions to ensure business continuity.
Prerequisites
Before proceeding, ensure you have:
An AWS account
Command Prompt / Terminal
Step 1: Sign in to AWS Management Console
Go to AWS Console using any browser.
Sign in with your AWS credentials.
Navigate to the EC2 Dashboard by searching for "EC2" in the AWS search bar.
Step 2: Launch an EC2 Instance
Click on Instances from the left-hand menu.
Click on the Launch Instances button.
Provide an instance name under Name and Tags (e.g., "My-First-EC2").
Step 3: Choose an Amazon Machine Image (AMI)
Under the Application and OS Images (Amazon Machine Image) section, choose an AMI.
Select Amazon Linux, macOS, Ubuntu, or any other required OS.
Step 4: Choose an Instance Type
Select an instance type based on your needs.
The t2.micro instance is free-tier eligible and suitable for beginners.
Click Next: Configure Instance Details.
Step 5: Choose Key pair Details
Select the key pair name
If not create the new key pair which is very essential during login of EC2.
Select the Key Pair type as RSA or ED25519
Select the Private Key file format as .pem or .ppk
Step 6: Configure Network Settings
Choose Create a new security group.
Allow SSH access by selecting Allow SSH traffic from Anywhere for simple and fast access of EC2 instance.
Step 7: Add Storage
The default 8GB of General Purpose SSD (gp2/gp3) is usually sufficient.
Adjust the storage size if necessary.
Click Review and Launch.
Step 8: Review and Launch
Review all your configurations.
Click Launch.
Download the .pem file
Click Launch Instance.
Step 9: Successfully EC2 is created
- Make sure that Instance is in Running state
Step 10: Connect to Your EC2 Instance
Go to Instances in the EC2 dashboard (shown above).
Select Instance ID.
Copy the Public IP address to connect the EC2 through Terminal/Command Prompt directly.
Open the Windows PowerShell or Command Prompt.
Use the Shell Command by replacing the required details.
ssh -i /path/to/private-key.pem user@server-ip
Replace the path/to to your Users and Username, rename the .pem file name and finally paste the copied Public IPv4 address.
Allow the Connection by typing yes.
You are successfully connected to the remote Ubuntu server via SSH.
Your EC2 instance is now up and running!
Conclusion
Setting up an AWS EC2 instance is an essential skill for cloud computing. By following these steps, you have successfully launched and connected to an EC2 instance. You can now install software, deploy applications, and explore AWS further.
Subscribe to my newsletter
Read articles from Himanth Akula directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Himanth Akula
Himanth Akula
Hi to the fellow tech enthusiasts out there! ๐ I'm an aspiring Cloud and DevOps Engineer โ๏ธ ๐ Passionate about creating resilient, secure, and cost-effective infrastructure on AWS. ๐ณ Proficient in containerization with Docker and Kubernetes. ๐ Building expertise in CI/CD pipelines using Jenkins, GitHub Actions, AWS CodePipeline, and more. ๐ Exploring Infrastructure as Code (IaC) with Terraform and configuration management with Ansible. ๐ Dedicated to continuous learning and sharing knowledge to grow together with the tech community. Let's connect and innovate! ๐ค