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
- Go to EC2 Dashboard > Security Groups.
- 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
- Select the instance in the EC2 dashboard.
- Click Actions > Security > Change Security Groups.
- 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
- General Purpose (e.g., T2, T3): For balanced compute, memory, and networking. Ideal for development environments.
- Compute Optimized (e.g., C5): Best for high-performance computing tasks like data analysis or gaming.
- Memory Optimized (e.g., R5): For memory-intensive applications like databases.
- Storage Optimized (e.g., I3): Best for high-speed storage and large data sets.
- 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
- On-Demand:
- Pay for compute capacity by the second or minute.
- Best for short-term workloads.
- Reserved Instances:
- Commit to a 1- or 3-year term for significant discounts.
- Ideal for predictable workloads.
- 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
- Go to EC2 Dashboard > Launch Instance.
- Select Windows Server AMI from the list.
- Choose an instance type (e.g., T2 Micro).
- Configure the instance and create a new key pair (or use an existing one).
- Review and launch the instance.
Connecting to a Windows Instance
- In the EC2 dashboard, select the instance.
- Click Connect > RDP Client.
- Download the
.rdpfile. - Click Get Password and upload your key file to decode the admin password.
- Open the
.rdpfile, enter the password, and click Yes to connect.
5. Launching a Linux Instance
Steps to Launch a Linux Instance
- Go to EC2 Dashboard > Launch Instance.
- Select a Linux AMI (e.g., Ubuntu).
- Choose an instance type (e.g., T2 Micro).
- Configure the instance and add a key pair.
- Review and launch the instance.
Connecting to a Linux Instance
From a Linux/Mac Machine
- Open your terminal and run:
ssh -i /path/to/key.pem ubuntu@<public-ip>
From Windows (Using PuTTY)
- Convert
.pemto.ppkusing PuTTYgen. - Open PuTTY and provide:
- Host:
<public-ip> - Key file: Upload the
.ppkfile.
- Connect to the instance.
6. Accessing Windows Instances from Linux
- Install an RDP client on your Linux machine (e.g.,
rdesktoporRemmina). - Run the RDP client and connect to your Windows instance using its public IP and admin password.
7. Verifying Network Settings
- On Windows: Use
ifconfigoripconfigin 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.
