This guide covers essential AWS EC2 concepts like security groups, instance types, pricing, and the steps to launch and connect to Windows and Linux instances.

1. Security Groups

A security group acts as a virtual firewall for your EC2 instance, controlling inbound (incoming) and outbound (outgoing) traffic.

Why are Security Groups Needed?

  • To allow or restrict access to your instance.
  • To define which ports or IP addresses can connect.

Inbound and Outbound Rules

  • Inbound Rules: Define what traffic is allowed to the instance (e.g., SSH, HTTP, HTTPS).
  • Outbound Rules: Define what traffic is allowed from the instance.

Creating a Security Group

  1. Go to EC2 Dashboard > Security Groups.
  2. Click Create Security Group and configure the rules:
  • Name: Provide a descriptive name.
  • Inbound Rules: Add rules to allow traffic (e.g., SSH, HTTP, or All Traffic for testing purposes).
  • Outbound Rules: By default, all outbound traffic is allowed.

Modify Security Group for an Existing Instance

  1. Select the instance in the EC2 dashboard.
  2. Click Actions > Security > Change Security Groups.
  3. Attach a new or existing security group.

2. EC2 Instance Types

AWS provides multiple instance types, each suited for specific workloads.

Categories of Instance Types

  1. General Purpose (e.g., T2, T3): For balanced compute, memory, and networking. Ideal for development environments.
  2. Compute Optimized (e.g., C5): Best for high-performance computing tasks like data analysis or gaming.
  3. Memory Optimized (e.g., R5): For memory-intensive applications like databases.
  4. Storage Optimized (e.g., I3): Best for high-speed storage and large data sets.
  5. GPU Instances (e.g., G4): For machine learning and video processing.

Understanding "T2 Micro"

  • T2: Indicates a general-purpose instance type.
  • Micro: Refers to a specific size with 1 vCPU and 1GB memory.

3. AWS Pricing Models

AWS offers flexible pricing models to match your usage and budget:

Pricing Types

  1. On-Demand:
  • Pay for compute capacity by the second or minute.
  • Best for short-term workloads.
  1. Reserved Instances:
  • Commit to a 1- or 3-year term for significant discounts.
  • Ideal for predictable workloads.
  1. Spot Instances:
  • Use spare AWS capacity at reduced rates.
  • Best for non-critical or flexible workloads.

Pricing by OS

  • Linux/Windows: Billed per second or minute.
  • Other Operating Systems: Typically billed per hour.

4. Launching a Windows Instance

Steps to Launch a Windows Instance

  1. Go to EC2 Dashboard > Launch Instance.
  2. Select Windows Server AMI from the list.
  3. Choose an instance type (e.g., T2 Micro).
  4. Configure the instance and create a new key pair (or use an existing one).
  5. Review and launch the instance.

Connecting to a Windows Instance

  1. In the EC2 dashboard, select the instance.
  2. Click Connect > RDP Client.
  3. Download the .rdp file.
  4. Click Get Password and upload your key file to decode the admin password.
  5. Open the .rdp file, enter the password, and click Yes to connect.

5. Launching a Linux Instance

Steps to Launch a Linux Instance

  1. Go to EC2 Dashboard > Launch Instance.
  2. Select a Linux AMI (e.g., Ubuntu).
  3. Choose an instance type (e.g., T2 Micro).
  4. Configure the instance and add a key pair.
  5. Review and launch the instance.

Connecting to a Linux Instance

From a Linux/Mac Machine

  1. Open your terminal and run:
ssh -i /path/to/key.pem ubuntu@<public-ip>

From Windows (Using PuTTY)

  1. Convert .pem to .ppk using PuTTYgen.
  2. Open PuTTY and provide:
  • Host: <public-ip>
  • Key file: Upload the .ppk file.
  1. Connect to the instance.

6. Accessing Windows Instances from Linux

  1. Install an RDP client on your Linux machine (e.g., rdesktop or Remmina).
  2. Run the RDP client and connect to your Windows instance using its public IP and admin password.

7. Verifying Network Settings

  • On Windows: Use ifconfig or ipconfig in the command prompt to verify network details.
  • In AWS: Check instance details in the EC2 dashboard.

Summary of Key Commands

Action Command (Linux) Update packages sudo apt-get update Install a package sudo apt-get install <package> List network details ifconfig Connect to EC2 instance ssh -i /path/to/key.pem user@ip Start RDP from Linux Use Remmina or rdesktop With these notes, you’re well-prepared to manage EC2 instances, understand their pricing, and use security groups effectively.