接口端点 - 如何确保流量通过端点进行

发布于 2025-01-29 07:21:17 字数 462 浏览 6 评论 0原文

我有一个使用VPC向导

  • ONE AZ
  • ONE子网创建的VPC,一个私人子网一个
  • NAT Gateway One Gateway
  • One Gateway端点

,然后手动为EC2手动创建了一个接口端点,

我在私有子网中启动了EC2,也在私有子网中启动了一个bastion主机,并在公共子网(以便我可以在私有子网中向EC2进行SSH)

问题:在创建到EC2的接口端点后,我如何确保/检查流量是否越过端点而不是Internet?

有多种方法可以检查网关端点的此行为 - 如图所示在这里

预先感谢。

I have a VPC created using the VPC wizard

  • one AZ
  • one Public subnet, one Private subnet
  • one NAT Gateway
  • one Gateway Endpoint for S3

I then manually created a Interface Endpoint for EC2

I launched a EC2 in the private subnet and also a bastion host in the public subnet (so that I can ssh to the EC2 in private subnet)

The question: After creating the Interface Endpoint to EC2, how do I ensure/check that the traffic is going over the endpoint and not the internet?

There are ways to check this behavior for the Gateway Endpoint - as shown here

Thanks in advance.

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

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

发布评论

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

评论(1

栖竹 2025-02-05 07:21:17

谢谢@marcin和@ervinszilagyi,

事实证明,我需要

  • 根据所使用的接口端点和端口,即VPC端点附加的安全组必须允许从私人子网上允许在相关端口上接入的连接,我需要在SG中具有相关的入站规则。 VPC中

在启用端口443(https)上的入站规则后的

,我可以进行这些测试以确认仅通过接口端点才会发生连接。注意:我在下面显示awsbatch的示例 - 对于任何接口端点,都可以执行相同的操作(如果尝试其他端点,例如SES SMTP端点,请确保您更改适当的端口号码命令

  • sudo traceroute -n -t -p 443批次。<区域> .amazonaws.com
  • sudo telnet Batch。<区域> .amazonaws.com 443
  • sudo nslookup<批处理接口端点的DNS名称>

sudo traceroute -n -t -p 443批次。<区域> .amazonaws.com

1  * * *
2  * * *
3  * * *
4  < IP Address >  1.313 ms  1.587 ms  1.463 ms

sudo telnet batch。&lt; region&gt; .amazonaws.com 443

Trying IP Address ...
Connected to batch.< region > .amazonaws.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

关闭telnet连接的有用链接 - 我很难正确获得逃生角色: https://www.redhat.com/sysadmin/sysadmin/telnet-netcat-troubleshooting

现在,如果我做过批处理接口端点的DNS名称&gt; ,它会给我以上2个命令和其他有用信息所反映的IP地址。

其他有用的链接:

  • ​network-acl-vpc-endpoint/“ rel =” nofollow noreferrer“> https://aws.amazon.com/premiumsupport/knowledge-center/security-center/security-network-network-acl-vpc-endpoint/

希望这会有所帮助全部。

Thanks @Marcin and @ErvinSzilagyi

Turns out that I needed to have the relevant inbound rules in my SG

  • Based on the Interface Endpoint being used and the port, the security group attached to the VPC endpoint must allow incoming connections on the relevant port from private subnet of the VPC

After I enabled inbound rules on port 443 (https), I could do these tests to confirm connectivity happens only via Interface Endpoint.

Note: I am showing examples below for awsbatch - the same can be done for any Interface Endpoint (if trying a different endpoint like say smtp endpoint, make sure you change the appropriate port number in the command)

  • sudo traceroute -n -T -p 443 batch.< region >.amazonaws.com
  • sudo telnet batch.< region >.amazonaws.com 443
  • sudo nslookup < DNS Name of Batch Interface Endpoint >

sudo traceroute -n -T -p 443 batch.< region >.amazonaws.com

1  * * *
2  * * *
3  * * *
4  < IP Address >  1.313 ms  1.587 ms  1.463 ms

sudo telnet batch.< region >.amazonaws.com 443

Trying IP Address ...
Connected to batch.< region > .amazonaws.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

Useful link for closing Telnet connections - I had trouble getting the escape characters correct : https://www.redhat.com/sysadmin/telnet-netcat-troubleshooting

Now, if I did sudo nslookup < DNS Name of Batch Interface Endpoint > , it would give me the IP address reflected by the above 2 commands and other useful info.

Other useful links:

Hope this will help all.

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