1

All,

I designing an application with HA, that will be deployed across multiple AZs in a single region of AWS. Its come to my attention that (even after purchasing a reserved instance), AWS cannot provide a guarantee that an EC2 can be launched in 2nd AZ when primary (AZ1) goes down.

This is unlikely since AWS will have enough capacity provisioned to allow its customers use AZ2 when AZ1 is out of service but nevertheless this is probable (in the event where all customers move from AZ1 to AZ2 and there is a genuine resource constraint in AWS datacenter AZ2).

The only alternative seems to be run an EC2 (or keep it up) in the 2nd AZ (even if not being used) with the aim of using it when AZ1 goes down.

This means we will incur the cost of keeping these EC2s up all the time in AZ2.

Wondering if anyone else has this problem? And overcome this?

user2595169
  • 147
  • 1
  • 14
  • It sounds like you're planning to manually failover your deployment, which is the wrong approach. The standard approach is to have always-on servers, with a load balancer to distribute load between them. This gives you availability _and_ scaling. – Parsifal Feb 02 '22 at 13:27
  • With always on, I don't think I can force to have a min=1 and max=1 on each of the 2 AZs. AWS arbitrarily decides which AZ to use. As described here: as per this link: https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-benefits.html " Amazon EC2 Auto Scaling attempts to launch the instances in another Availability Zone until it succeeds". In my use-case - I want to guarantee that AWS can provision EC2 in AZ2 when AZ1 goes down and the only way to do this it appears is to forcefully keep it up (manually) and not rely on Auto scaling group. – user2595169 Feb 02 '22 at 13:37
  • I see that you have already found the documentation that describes how auto-scaling works. So what you're faced with is a cost-benefit analysis: if it is critical that your application always be up, _then it doesn't matter how much it costs to do that._ Always-on instances in multiple regions, and possibly multiple cloud providers are the only solution. If that's too expensive for you, then you should reconsider the criticality of your application. Or whether a cloud deployment is appropriate. – Parsifal Feb 02 '22 at 13:41
  • Thanks @Parsifal – user2595169 Feb 02 '22 at 15:32

1 Answers1

0
  1. If you are working on a greenfield project (Newly initiated & no legacy code), consider using serverless architecture. Not only that it enables us to get native HA, Multi AZ and scalability, it also promotes the pay for what you use model compared to the serverful design of EC2 where we have to pay for the VMs even if they are idle on low traffic times.
  2. Consider using auto-scaling groups as it automatically manages the distribution of your instances in different availability zones of a region, to distribute HTTP traffic between these instances, you will have to introduce a combination of application load balancer and target groups.
Allan Chua
  • 9,305
  • 9
  • 41
  • 61
  • Thanks, unfortunately I cannot use serverless since there is legacy code. With autoscaling-groups: as per this link: https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-benefits.html " Amazon EC2 Auto Scaling attempts to launch the instances in another Availability Zone until it succeeds". So in-effect AWS tries to create EC2 on best effort basis - which is disappointing if on a worst case scenario that AZ has reached capacity. Again, this is very unlikely but a critical HA application looks like AWS doesn't provide an alternative... – user2595169 Feb 02 '22 at 13:29