Elastic IP pricing clarifications and recommendations

,

Question: How does external DNS hostname resolution work for elastic IP and how the pricing is affected if external hostname is accessed within the same VPC. According to Amazon EC2 instance IP addressing - Amazon Elastic Compute Cloud , external hostnames are resolved to private IP address of an ec2 instance if accessed within the same VPC. Does accessing the external hostname tied to an elastic IP always resolve to private ip address of an ec2 machine within the same VPC, thus equating to free bandwidth?

Recommendation: I will be configuring a highly available database which is accessed primarily from within the same VPC, but may occasionally have serve external traffic. When a node failures occurs, the elastic IP will be remapped to a new node thus avoiding reconfiguring public and private clients. It seems like in this exact usage scenario, using the elastic IP’s external DNS (assuming it maps to private IP if accessed within same VPC) seems like a good solution. I believe the technical term is called “Split-horizon DNS”. Are there any gotachas to this implementation? Are there any recommendations for a managed solutions that works across different cloud vendors?

Use multi az databases instead because it will automatically route traffic from failure node to healthy node. And you have only 5 Elastic IPs per Region at all so trying to avoid using Elastic IPs is my recommendation.

You can request more, there are people with hundreds of elastic IPs. Don’t avoid using them where they’re the best choice because of a soft limit, just request an increase.

That being said; yeah… use a multi-az database, don’t implement your own failover, there’s a reason everyone uses RDS, because it solves very real issues that are actually a pain to manage and test.

Source: I work at AWS

I think you’re conflating DNS and IP routing here.

I can make a public DNS record that points to an internal network IP, and that’s perfectly acceptable as far as the standards go. Split horizon DNS is about having a single name, let’s call it db.example.com accessible on the public internet as 1.2.3.4 but when I try to access the DNS name db.example.com from within my private network (VPC in the AWS case) it resolves to a different IP; 10.0.0.5.

Whether that IP is elastic or where it is hosted is… not material to how DNS manages this; all DNS knows is the number, not where it is or how to route to it.

That being said; database failover is not as simple as it might look, and has many gotchas, if at all possible you should avoid having to take that on yourself, unless of course your business is selling people redundant databases.

What kind of database are you trying to run? and why would you ever want someone external accessing the database directly?

We have services which operate across cloud providers thus may occasionally access data from outside of aws. Utilizing split horizon DNS + Elastic Ip, we can keep the hostname configurations the same across cloud providers. In the event that something fails, we can simply remap the elastic IP to another node. Having split horizon DNS on elastic IP also ensures that we don’t utilize the actual elastic IP when communicating within the same VPC. Communicating through elastic IP cost 2c/GB (1 in each direction), thus an unnecessary cost.

As for the database, I am experimenting with MongoDB. Due to their licensing restrictions, there are very few alternatives besides their Atlas service which is absurdly expensive when you only need the capacity but not the performance.

Not “everyone” uses RDS. RDS sucks for high-IO workloads.

You are right that it’s indeed very painful, and we are looking into DocumentDB and planning to move some suitable data to the service. However, for locations where DocumentDB cannot be easily accessed or accessed cheaply, we’d have to create our own.

How come? RDS is just managed DB. Are you saying MySQL & Postgres (and others) suck for high IO workloads? I can see that being true for super high IO workloads, but how high are you talking about?

RDS uses EBS for db storage.

I don’t think the hostname for the public IP of the EC2 instance will map to the IP of your EIP. You’ll most likely need to manage your own DNS records if you need myhost.mydomain.com to map to your EIP(s).

Which is the case for pretty much everything on AWS. In your opinion what’s the alternative to using RDS? Hosting on EC2? (In which case you’re still limited by EBS’ IOPS).

And you can go pretty high with provisioned IOPS if high IOPS is your use case.

…you know EC2 has instances with local NVMe storage right?

Yes and I’m sure you know those drives are ephemeral. Honestly you’d probably be able to achieve those IOPS using replicas.

Not to mention there’s a new EBS type with a couple hundred thousands of IOPS coming.

I don’t think the hostname for the public IP of the EC2 instance will map to the IP of your EIP. You’ll most likely need to manage your own DNS records if you need myhost.mydomain.com to map to your EIP(s).

If it’s accessed externally, ec2-<dash-separated-elastic-ip-addr>.us-east-2.compute.amazonaws.com seems to always maps to elastic-ip-addr. The question was simply to confirm that the external DNS record of the EIP will always map to the private IP of the currently assigned ec2 instance even after remapping to another instance.

Why does it matter if they’re ephemeral? Sure it increases the need for diligence in disaster planning and redundancy, but -shrug-

Replicas don’t solve everything. Let’s say your application has a ton of pretty inefficient queries against massive tables and they cannot be optimized due to the structure of the DB. These queries can’t be made faster through replicas. Sure, you could handle more of the same query in parallel — but that isn’t necessarily useful.

Really not an issue if you design shit right.

Ephemeral storage is perfectly fine. You should be able to lose a significant portion of your cluster without data loss, or you’re doing something wrong. Cattle, not pets.

Literally thousands of companies use ephemeral storage for their databases on AWS with no ill effect. It’s even marketed specifically for that use-case.

If you’re afraid of ephemeral storage, you’re doing things wrong.

Edit: shit, if you’re using EBS as a sort of permanent storage for your DB, you’re still doing it wrong. An EBS volume shouldn’t live any longer than the instance it is attached to.

There were no broad generalizations. In fact, I was specifically negating the original bullshit broad generalization of “everyone” using RDS.

Not different critters at all. Postgres and MySQL are pretty simple to get set up to handle this cleanly – Postgres especially. Been doing it for… well, almost 14 years on AWS and 20 years in total.

Sharding doesn’t help. Aurora fails under the use-cases I outlined. AWS tried for 3 months to get RDS (including Aurora) to handle our use-case at the company I was leading syseng at ~1.5 years ago, and in the end they simply couldn’t get it to work. And we didn’t even have that strange of a use-case. Come to find out, it’s been a problem they’ve consistently struggled solving for companies who suffer from poor initial DB design and insufficient technical resources to rearchitect. :wink: Which is, itself, also /ridiculously/ common.

Having a database with a public ip sounds like a bad idea from a security perspective..

Personally, I think you need to be using RDS. All of this is managed for you during the failover when running Multi-AZ. The IP address just change underneath the same endpoint name.