AWSCloudHow ToTech/WebTutorials/DIY

How to Launch EC2 Instance in AWS

Launching an EC2 (Elastic Compute Cloud) instance in AWS is a fundamental step in building scalable cloud applications. EC2 provides resizable compute capacity, making it easier for developers to run and manage applications efficiently. This guide outlines the step-by-step process to launch an EC2 instance in AWS.

Prerequisites

Before starting, ensure you have the following:

  • An active AWS account
  • Basic understanding of AWS services
  • Installed and configured AWS CLI (optional but helpful)

Step 1: Log in to AWS Management Console

  1. Go to the AWS Management Console.
  2. Sign in using your AWS account credentials.

Step 2: Navigate to the EC2 Dashboard

  1. In the AWS Management Console, search for EC2 in the search bar.
  2. Click on EC2 under Services to open the EC2 Dashboard.

Step 3: Choose “Launch Instance”

  1. On the EC2 Dashboard, click on the Launch Instance button.
  2. Enter a suitable name for your instance under Name and tags.

Step 4: Select an Amazon Machine Image (AMI)

  1. AMI acts as the base image for your instance. Choose one based on your operating system preference.
  2. Common choices include:
    • Amazon Linux 2023 (Free Tier eligible)
    • Ubuntu Server
    • Windows Server
  3. Click Select next to your chosen AMI.

Step 5: Choose an Instance Type

  1. Select an instance type that fits your workload requirements.
  2. For basic usage, select t2.micro (Free Tier eligible).
  3. Click Next: Configure Instance Details.

Step 6: Configure Instance Details

  1. Set the number of instances you want to launch.
  2. Network settings can typically be left at their default values for basic configurations.
  3. Enable Auto-assign Public IP to access the instance over the internet.
  4. Click Next: Add Storage.

Step 7: Add Storage

  1. By default, the recommended storage volume is 8 GB (for Free Tier).
  2. Increase storage if your application requires more capacity.
  3. Click Next: Add Tags.

Step 8: Add Tags (Optional but Recommended)

  1. Tags are key-value pairs that help identify your resources.
  2. For example: Key: Name, Value: MyWebServer.
  3. Click Next: Configure Security Group.

Step 9: Configure Security Group

  1. Security groups act as virtual firewalls for your instance.
  2. Click Create a new security group.
  3. Add rules for inbound traffic, such as:
    • HTTP (port 80) for web servers
    • SSH (port 22) for remote access
  4. Click Review and Launch.

Step 10: Review and Launch

  1. Review all configurations to ensure they meet your requirements.
  2. Click Launch.
  3. When prompted, select an existing key pair or create a new one. Download the .pem file and keep it safe. This file is required for SSH access.

Step 11: Access Your EC2 Instance

  1. Go back to the EC2 Dashboard.
  2. Under Instances, select your running instance.
  3. Copy the Public IPv4 address.
  4. Open your terminal and connect using the following command:
    ssh -i /path/to/your/key.pem ec2-user@your-public-ip
    

Step 12: Verify Instance Functionality

  1. Once connected, you can install packages, configure services, and deploy applications.
  2. Use commands like:
    sudo yum update -y
    sudo apt update && sudo apt upgrade -y
    

Step 13: Setting Up Elastic IP (Optional but Recommended)

To ensure your instance retains a fixed IP address, consider assigning an Elastic IP.

  1. Go to the Elastic IPs section in the EC2 dashboard.
  2. Click Allocate Elastic IP address.
  3. Associate the Elastic IP with your instance.

Step 14: Terminating an EC2 Instance (If No Longer Needed)

  1. On the EC2 Dashboard, select the instance you want to terminate.
  2. Click Instance State -> Terminate Instance.

Conclusion

By following these steps, you can successfully launch and manage an EC2 instance in AWS. Whether you are developing, testing, or hosting web applications, AWS EC2 offers a flexible and scalable solution for your cloud computing needs. Always remember to secure your instance, configure backups, and monitor resource usage for optimal performance.

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

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