EC2 - Security Groups/Ports/SSH Flashcards
What is a Security Group?
A Security Group is a virtual firewall for your EC2 instances that controls inbound and outbound traffic. It only allows specific types of traffic based on set rules.
What types of traffic do Security Groups control?
Security groups control inbound (from the internet to your EC2 instance) and outbound (from the EC2 instance to the internet) traffic.
What information do you define in a security group rule?
Each rule specifies:
Type (e.g., SSH, HTTP)
Protocol (e.g., TCP)
Port (e.g., port 22 for SSH)
Source (e.g., IP range like 0.0.0.0/0 or another security group).
What are the default behaviors of a Security Group?
By default, all inbound traffic is blocked and outbound traffic is allowed.
Security groups can be attached to multiple EC2 instances, and each instance can have multiple security groups.
What happens if an EC2 instance is not accessible or times out?
If an EC2 instance doesn’t respond or times out, it’s likely a security group issue blocking inbound traffic. If you see a connection refused error, the traffic reached the instance but the application rejected it.
What is the advanced feature of referencing other security groups?
You can configure a security group to allow traffic from other security groups, regardless of the EC2 instances’ IP addresses. This simplifies communication between instances without needing to manage IP addresses directly.
What does an inbound security group rule look like?
Type: SSH
Protocol: TCP
Port: 22
Source: 0.0.0.0/0 (all IPs, but typically more restrictive).
What are some important ports to remember for security groups?
22: SSH (for Linux EC2)
21: FTP (for file transfer)
80: HTTP (unsecured websites)
443: HTTPS (secured websites)
3389: RDP (for Windows EC2)
What is SSH used for in AWS EC2?
SSH (Secure Shell) is used to securely connect to EC2 instances for maintenance or other tasks, typically on Linux-based systems.
How do you connect to an EC2 instance using SSH on Mac or Linux?
On Mac or Linux, you can use the terminal and run the ssh command with the private key (.pem file) to connect to your EC2 instance.
How do you connect to an EC2 instance using SSH on Windows (pre-Windows 10)?
On Windows versions before 10, use PuTTY, a free SSH client, to connect to the EC2 instance using your private key.
How do you connect to an EC2 instance using SSH on Windows 10 and newer versions?
On Windows 10 or later, you can use the built-in SSH command in the Command Prompt or PowerShell (similar to Mac/Linux).
What is EC2 Instance Connect and how does it work?
EC2 Instance Connect allows you to connect to EC2 instances directly from your web browser without needing to install anything. It supports Mac, Linux, and Windows.
Which EC2 instance types are compatible with EC2 Instance Connect?
EC2 Instance Connect currently works with Amazon Linux 2 instances.
What should you do if you’re having trouble connecting to an EC2 instance via SSH?
Double-check your security group rules (make sure port 22 is open).
Verify the SSH command or Putty settings.
Check for typos in the IP address or command.
Try EC2 Instance Connect, as it might bypass other issues.
If all else fails, consult the troubleshooting guide.