How to Launch an EC2 Instance on AWS (Step-by-Step Guide)

Amazon EC2 (Elastic Compute Cloud) is one of the core services in AWS that lets you launch virtual machines in the cloud. Whether you’re deploying an app, hosting a website, or running DevOps tools, EC2 is often your starting point.

Let’s walk through the step-by-step process to create an EC2 instance from the AWS Management Console.


🧭 Step-by-Step Guide to Launch an EC2 Instance

Step 1: Log in to AWS Console

Go to https://console.aws.amazon.com, and sign in with your credentials.


Step 2: Navigate to EC2 Dashboard

Search for EC2 in the AWS Services search bar and click on EC2 under “Compute”.


Step 3: Click “Launch Instance”

Click on the Launch Instance button.


Step 4: Configure the Instance

  1. Name and Tags:
    Give your instance a name like my-dev-server.
  2. Choose AMI:
    • Select Amazon Linux 2 or Ubuntu 22.04 LTS depending on your preference.
  3. Instance Type:
    • Choose t2.micro (eligible for free tier).
  4. Key Pair (Login):
    • Create a new key pair (RSA or ED25519).
    • Download and store the .pem file securely.
  5. Network Settings:
    • Allow SSH (port 22) and optionally HTTP (port 80).
    • Make sure the security group is open only to your IP for SSH.
  6. Storage:
    • Leave default (8 GB gp2 EBS) or increase if needed.

Step 5: Launch the Instance

Review your settings and click Launch Instance.

You’ll be redirected to a confirmation screen. Click View Instances to monitor its state.


Step 6: Connect to Your EC2 Instance

  1. Open your terminal.
  2. Run: bashCopyEditchmod 400 my-key.pem ssh -i "my-key.pem" ec2-user@<Public-IP>
  3. You are now logged into your cloud server!

💡 Best Practices

  • Use IAM roles instead of storing AWS credentials on the instance.
  • Regularly rotate your key pairs.
  • Enable CloudWatch monitoring for visibility.
  • Always restrict security groups to required IPs and ports.

🔗 Internal Links


🔗 External Resources


🧩 Common Use Cases for EC2

  • Host DevOps tools like Jenkins or GitLab
  • Run web servers with Apache/Nginx
  • Deploy container runtimes like Docker or Kubernetes
  • Test apps in isolated environments

Summary

Launching an EC2 instance is one of the first steps in building infrastructure on AWS. It’s flexible, scalable, and integrates smoothly with other AWS services. Once it’s up and running, you can install your DevOps tools, host applications, or begin infrastructure automation using Ansible, Terraform, or CloudFormation.


Leave a Comment

Your email address will not be published. Required fields are marked *