【问题标题】:Use EC2 server as Nat gateway [closed]使用 EC2 服务器作为 Nat 网关 [关闭]
【发布时间】:2021-09-15 02:10:19
【问题描述】:

我们应该使用一个非常小的 ec2 服务器作为 nat 网关吗?我们想使用 Amazon ElastiCache Memcached,它将在 vpc 中,ec2 服务器作为 nat 网关会更便宜吗?

【问题讨论】:

  • 您能否提供更多有关您希望通过解决方案实现的目标的背景信息?它只是一个小的概念证明吗?还是打算在生产中运行?
  • ElastiCache 不需要 NAT 网关。你想在这里做什么? NAT 网关是为了让 VPC 内部的事物能够访问 VPC 外部的事物,但 ElastiCache 不需要访问 VPC 外部的事物。如果您尝试从 VPC 外部访问 VPC 资源,那么 NAT 网关根本无济于事。

标签: amazon-web-services amazon-ec2 memcached aws-nat-gateway elastic-cache


【解决方案1】:

无论您的用例是什么,我都不建议这样做。 如果只是为了一个小型 POC 并且您的预算确实有限,以至于 50 美元太多了, 您可以随时公开 elasticache。 编辑说明:结果很棘手。似乎私人是目前唯一的选择。另外,为了完整性:正如 Mark b 所提到的。 elasticache 服务本身不需要出站访问,因此 NAT 无济于事。

但是请注意,elasticache 本身也相当昂贵,所以我有点怀疑 NAT 网关与 EC2 的关系到底有多重要。

但更一般地说,我不建议在 EC2 上托管 NAT,因为它需要花费设置时间和维护时间。如果您花一天(或两天)设置和管理 EC2,即使只是 POC,它也可能比您节省的 50 美元贵得多。特别是如果您为按小时向您付款的客户这样做。然后就拿NAT网关。它的维护更少、性能更高、更可靠。

【讨论】:

  • ElastiCache 不支持公共访问。它只是 VPC。
  • 啊,我真的不记得了,被这段文档甩了:The basic functionality of ElastiCache is the same in a virtual private cloud; ElastiCache manages software upgrades, patching, failure detection and recovery whether your clusters are deployed inside or outside an Amazon VPC. ElastiCache cache nodes deployed outside an Amazon VPC are assigned an IP address to which the endpoint/DNS name resolves. This provides connectivity from Amazon Elastic Compute Cloud (Amazon EC2) instances. (docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/…)
  • 更新了我的答案@Mark B.
猜你喜欢
  • 2023-03-14
  • 1970-01-01
  • 1970-01-01
  • 2016-10-28
  • 2013-09-30
  • 1970-01-01
  • 2018-01-26
  • 1970-01-01
  • 2012-08-02
相关资源
最近更新 更多