-2

Should we use an really small ec2 server as nat gateway? We want to use Amazon ElastiCache Memcached and it will be inside vpc, will ec2 server be cheaper as nat gateway?

  • Can you provide more context of what you want to achieve with your solution? Is it just a small proof of concept? Or intended to run in production? – LRutten Sep 14 '21 at 08:23
  • ElastiCache does not need a NAT Gateway. What are you trying to do here? A NAT Gateway is for things inside the VPC to be able to access things outside the VPC, but ElastiCache does not need to access things outside the VPC. If you are trying to access VPC resources from outside of the VPC then a NAT Gateway doesn't help with that at all. – Mark B Sep 14 '21 at 13:30

1 Answers1

1

Whatever your use-case is, I would not advise on that. If it's just for a small POC and you're really limited in your budget so that 50 dollars is too much, you can always put elasticache public. Edit note: turns out to be tricky. Seems like private is the only option for now. Also, for completeness: as mentioned by Mark b. the elasticache service itself doesn't need outbound access so NATs won't help.

Note however that elasticache itself it also quite expensive so I'm a bit skeptical in how much that NAT gateway vs EC2 thing actually matters.

But more generally, I would not recommend to host NAT on EC2 because of the setup time and maintenance time it costs. If you spend a day (or two) setting up and managing that EC2, even just for a POC it's probably way more expensive than the 50 dollars you save. Especially if you do this for a client, who pays you on an hourly basis. Then just take the NAT gateway. It's less maintenance, more performing and more reliable.

LRutten
  • 1,634
  • 7
  • 17
  • 1
    ElastiCache doesn't support public access. It is VPC only. – Mark B Sep 14 '21 at 13:29
  • Ah I couldn't really remember and was thrown off by this piece of docs: `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.` (https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/VPCs.EC.html) – LRutten Sep 14 '21 at 17:58