Getting Started with AWS EC2 and Security Groups: A Beginner's Guide

Getting Started with AWS EC2 and Security Groups: A Beginner's Guide

Week 1 - Creation of AWS EC2 and Security Groups

How to Create an EC2 Instance and Configure Security Groups on AWS

AWS EC2 (Elastic Compute Cloud) allows you to create virtual servers in the cloud. Security Groups act as virtual firewalls, controlling inbound and outbound traffic to your instance.

Here’s a step-by-step guide to get you started:

Step 1: Log in to AWS Console

  • Go to the AWS Management Console.

  • Sign in with your credentials.

Step 2: Navigate to EC2 Dashboard

  • In the Console, search for “EC2” and select EC2 Dashboard.

  • Click on Launch Instance.

Step 3: Configure EC2 Instance

  • Choose an Amazon Machine Image (AMI):

    • Select an AMI (e.g., Amazon Linux 2, Ubuntu).

    • For beginners, the Free Tier Eligible option is recommended.

  • Choose Instance Type:

    • Select an instance type based on your needs (e.g., t2.micro for Free Tier).

  • Create or Select a Key Pair

    • Choose Create a new key pair or use an existing one.

    • Download the .pem file and keep it safe (required for SSH access)

    • Create a New Security Group:

      • Give it a name (e.g., MySecurityGroup).

      • Description: Basic Security Group for EC2.

      • Set Inbound Rules:

        • SSH (Port 22): Allows remote access. Source: My IP for security.

        • HTTP (Port 80): Required if hosting a web server. Source: 0.0.0.0/0 to allow public access.

      • Set Outbound Rules:

        • By default, all outbound traffic is allowed.

        • Default storage is usually sufficient.

  • Add Tags (Optional):

    • Tags help organize your resources.

    • Add a Name tag (e.g., Name: MyEC2Instance).

  • Review and Launch:

    • Click Review and Launch to check all configurations.

    • Click Launch.

Conclusion

You’ve successfully created an EC2 instance and configured Security Groups on AWS!

Security Groups control access to your instance, so make sure to keep them up to date for enhanced security.