大网数据广告活动
服务器运维问答

Deny IP address on AWS ELB

· 52CE 我爱测

I've, more or less, following configuration on AWS: Elastic load balancer with 3 machines o 3 different availability zones. My security group allows 0.0.0.0/0:80 as it's my rails application (nginx, unicorn). I was wondering if t…

问题原文

原帖链接 · boris quiroz · CC BY-SA 3.0

I've, more or less, following configuration on AWS:

Elastic load balancer with 3 machines o 3 different availability zones. My security group allows 0.0.0.0/0:80 as it's my rails application (nginx, unicorn).

I was wondering if there's any way to deny access to my app to an specific public ip address? I've been reading AWS documentation, but as SG's are "deny all" there's no way to deny just one specific IP address.

Any ideas? iptables on the 3 machines behind load balancer?

Thanks!

社区高分解答

原帖链接 · Tama · CC BY-SA 3.0

A straight forward solution is to use a VPC Network ACL Inbound Rule. This only works if your ELB is in a VPC, but if you've created it in the last few years it should be in the default one.

To ban 1.2.3.4 for example, do the following:

  1. Login to AWS.
  2. Navigate to VPC.
  3. Choose Network ACLs from the left hand menu.
  4. Choose the ACL associated with the VPC your ELB is in.
  5. Choose the Inbound Rules tab.
  6. Choose Edit and add a new rule with the following attributes:
    • Rule #: 50 (any number as long as it's less than the rule that ALLOWs from ALL)
    • Type: ALL Traffic
    • Protocol: ALL
    • Port Range: ALL
    • Source: 1.2.3.4/32
    • Allow / Deny: DENY

There's a bunch more information about Network ACLs here: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-01-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。