0
0
AWScloud~30 mins

Why security groups matter in AWS - See It in Action

Choose your learning style9 modes available
Why Security Groups Matter
📖 Scenario: You are setting up a simple web server on AWS. To keep it safe, you need to control who can connect to it. AWS Security Groups act like a virtual firewall that controls traffic to your server.In this project, you will create a security group, add rules to allow web traffic, and then attach it to an EC2 instance.
🎯 Goal: Build an AWS security group that allows HTTP and SSH access, then attach it to an EC2 instance to protect your server from unwanted traffic.
📋 What You'll Learn
Create a security group named web-sg with a description Allow HTTP and SSH
Add an inbound rule to allow TCP traffic on port 80 from anywhere
Add an inbound rule to allow TCP traffic on port 22 from a specific IP 203.0.113.5/32
Create an EC2 instance named web-server and attach the web-sg security group
💡 Why This Matters
🌍 Real World
Security groups are essential to protect cloud servers from unauthorized access, just like locks on doors protect your home.
💼 Career
Understanding security groups is a fundamental skill for cloud engineers and system administrators to secure cloud infrastructure.
Progress0 / 4 steps
1
Create the security group
Create a security group named web-sg with the description Allow HTTP and SSH using AWS CLI syntax.
AWS
Need a hint?

Use aws ec2 create-security-group command with --group-name and --description options.

2
Add inbound rules to the security group
Add an inbound rule to the web-sg security group to allow TCP traffic on port 80 from anywhere (0.0.0.0/0), and another inbound rule to allow TCP traffic on port 22 from IP 203.0.113.5/32.
AWS
Need a hint?

Use aws ec2 authorize-security-group-ingress twice, once for port 80 and once for port 22 with the specified CIDRs.

3
Launch an EC2 instance with the security group
Launch an EC2 instance named web-server using the Amazon Linux 2 AMI, t2.micro instance type, and attach the web-sg security group by specifying its group name.
AWS
Need a hint?

Use aws ec2 run-instances with --security-groups web-sg and add a tag with Name=web-server.

4
Verify the security group attachment
Write the AWS CLI command to describe the EC2 instance named web-server and confirm it has the web-sg security group attached.
AWS
Need a hint?

Use aws ec2 describe-instances with a filter for the tag Name=web-server and query the SecurityGroups field.