如何使用许多安全组访问1个EC2实例?

发布于 2025-01-23 11:33:56 字数 590 浏览 1 评论 0原文

我有一个简单的设置 - 一个EC2充当Web服务器。

首先,我只允许1组IP(第一个办公室)访问服务器,因此我创建了一个安全组,并允许他们通过HTTP和HTTP访问EC2。

现在,一个新的办公室(具有不同的IPS)想访问Web服务器。最好的方法是什么?

我尝试的

  1. 将每个IP添加到原始安全组中的工作有效,但是我不知道几个星期后哪个IP属于哪个办公室。不可持续。

  2. 我创建了另一个安全组,并为每个新IP添加了HTTP/HTTPS的规则。 在新安全组中添加IPS到入站规则

IP团体。 将新的安全组添加到原始安全组 (新的安全组是屏幕截图中的前两个行)

我希望EC2实例现在允许新的IPS,但事实并非如此。 (我在这里错过了什么吗?!)

I have a simple setup -- one EC2 acts as a web server.

At first, I allowed only 1 set of IPs (the first office) to access the server, so I created a security group and allowed them to access the EC2 through HTTP and HTTPS.

A new office (with different IPs) now wants to access the webserver. What's the best way to do it?

What I have tried

  1. Adding each IP to the original security group works, but I will have no idea which IP belongs to which office in a few weeks. Not sustainable.

  2. I created another security group and added rules for HTTP/HTTPS for each new IP.
    Add IPs to inbound rule in new security group

Then I added the new security group to the original security group.
Add new security group to original security group
(The new security group is the first two rows in the screenshot)

I expected the EC2 instance to now allow the new IPs but it didn't. (Am I missing something here?!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮倦 2025-01-30 11:33:56
  1. 将每个IP添加到原始的安全组中,但我不知道几个星期后哪个IP属于哪个办公室。不是
    可持续。

每个安全组规则都可以具有可选的,最多255个字符。因此,我建议将Office名称添加为每个入站IP地址的描述。

  1. 我创建了另一个安全组,并为每个新IP添加了HTTP/HTTPS的规则。将IP添加到新安全组中的入站规则

将安全组添加到其他安全组中并不提供您要实现的功能。它仅允许将AWS资源与分配给他们的一个安全组一起访问资源,并与分配给他们的另一个安全组访问资源。它不允许在另一组中允许一个组中允许所有入站流量。

  1. Adding each IP to the original security group works, but I will have no idea which IP belongs to which office in a few weeks. Not
    sustainable.

Each Security Group rule can have an optional description, up to 255 characters. So I suggest adding the office name as the description for each inbound IP address.

  1. I created another security group and added rules for HTTP/HTTPS for each new IP. Add IPs to inbound rule in new security group

Adding security groups to other security groups doesn't provide the functionality you are trying to achieve. It only allows AWS resources with one security group assigned to them to access resources with the other security group assigned to them. It doesn't allow all inbound traffic allowed in one group to also be allowed in the other group.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文