Ad space (banner)
AD

Got the fundamentals? A structured AWS course is a fast way to level up.

Find AWS courses on Udemy

Affiliate link. Costs you nothing extra.

☁️AWS Lessons
Lesson 30 / 41

Creating a Security Group with aws ec2 create-security-group

When you need a new set of traffic rules, use aws ec2 create-security-group. It creates a security group.

The syntax is aws ec2 create-security-group --group-name name --description description. A freshly created group carries no rules at all.

Running aws ec2 create-security-group --group-name web-sg --description "web servers" creates the group and returns its GroupId.

A common stumble is creating the group and forgetting to add the inbound rules — creating it and configuring it are two separate steps.

In real work, separate groups per purpose (web servers, databases) allow each to permit only the minimum traffic required.

AWS
Try it (type this into the pseudo terminal)
aws ec2 create-security-group --group-name web-sg --description "web servers"

🧑‍💻 You can type this command into the AWS pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)