Skip to content

Amazon EBS blocking port 80 and 22

0

Hi Team, We have created a new EBS instance and found that 22 and 80 is opened by default. Do we have a option to remove the Remove default security group from EC2-Instance or to block the port 80?

  • Hi, your title is incorrect if you speak of Beanstalk: EBS stands for Elastic Block Storage. Please, fix if needed.

asked 2 years ago542 views
4 Answers
5

Hello,

To block ports 80 and 22 on your EC2 instance, go to the AWS Management Console and select your instance from the “Instances” section. In the “Description” tab, find the “Security groups” field and click on the security group name. In the security group details, navigate to the “Inbound rules” tab and click on “Edit inbound rules.” Remove the rules for ports 80 and 22 by clicking the “Delete” button next to each rule. Save the changes to apply the new security group rules. For more information, refer to the AWS documentation https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#deleting-security-group-rule

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
2

Hello,

Please try this solution it will be helpful for you.

Step 1 Select Your Instance:

In the left navigation pane, click on “Instances” and select the instance associated with the EBS volume.

Step 2 Modify Security Groups:

With your instance selected, look at the “Description” tab at the bottom. Find the “Security groups” field and click on the security group name.

Step 3 Edit Inbound Rules:

In the security group details page, click on the “Inbound rules” tab. Click on the “Edit inbound rules” button.

   To block port 80 (HTTP):

           Find the rule allowing traffic on port 80 and click the “Delete” button next to it.

    To block port 22 (SSH):

           Find the rule allowing traffic on port 22 and click the “Delete” button next to it.

Step 4 Save Changes:

After making the necessary changes, click “Save rules” to apply the new security group rules.

Please look at AWS document Link you will get more information.

https://docs.aws.amazon.com/ebs

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#deleting-security-group-rule

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
  • Note that while this procedure will work, it will affect all resources that are using the same default security group. The advice from gokul_guna shows how to create a new security group and to replace the default one for the instance in the question. That will only affect the single EC2 instance.

1

Hello,

Hope you are talking about EC2 instance and the default security group allowing all traffic.

  • You cannot create deny rule in security group but you can create deny rule in Network ACLs which works for whole subnet level.
  • For a particular EC2 instance, you can create new security group with only the rules that you want to allow and assign that security group to the EC2 instance and remove the default group. By this way you can block the ports that you donot want to. Refer to these documentations Create a security group and Change an instance's security group
AWS
answered 2 years ago
EXPERT
reviewed 2 years ago
0

Hello,

If you don't specify a security group when you launch an instance, the instance is automatically associated with the default security group for the VPC or you can create a new custom security group and attach it to the EC2 instance, https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#creating-security-group

or you can remove the security group rule for port 80 from the AWS EC2 console, please check the below link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#deleting-security-group-rule

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.