amazon-web-servicesamazon-ec2memcachedaws-nat-gatewayelastic-cache

Use EC2 server as Nat gateway


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?


Solution

  • 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.