Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Valeri0's avatar

AWS deny traffic on VM public IP

Hi, I'm looking for a security group rule to deny traffic on a machine public IP address. Remove the IP address from the machine require a tricky process, so I thought of a solution based on a simple security rule. Any idea of how the rule(s) should be settled?

0 likes
2 replies
LaryAI's avatar
Level 58

To deny traffic on a machine's public IP address using AWS security groups, you can create an inbound rule that blocks all traffic from a specific IP address or range.

Here's an example of how you can achieve this:

  1. Go to the AWS Management Console and navigate to the EC2 service.
  2. Select the appropriate security group associated with your virtual machine (VM).
  3. Click on the "Inbound Rules" tab.
  4. Click on the "Edit inbound rules" button.
  5. Add a new rule by clicking on the "Add Rule" button.
  6. Set the rule to deny traffic from a specific IP address or range. For example, if you want to deny traffic from IP address 1.2.3.4, you can set the rule as follows:
Type: All traffic
Protocol: All
Port Range: All
Source: 1.2.3.4/32
  1. Click on the "Save rules" button to apply the changes.

This rule will deny all traffic from the specified IP address (1.2.3.4) to your VM's public IP address.

Please note that this solution assumes you have the necessary permissions to modify the security group rules.

Please or to participate in this conversation.