0

Just looking for some general guidance here. I have an instance that is living in the us-west-1 region. I want to create a multi-region failover solution where if the instance in us-west-1 is stopped or terminated, a new instance in us-east-1 would spin up. I've tried this with AWS Backups but the only issue is that the new instance in us-east-1 spins up with a different hostname. This is an issue for me because I need the hostnames of the two instances to match so they can use the same license. Is there a way I can spin up a duplicate instance cross-region with the same hostname so that it can use the same license? Or can I at least failover cross-region and point to the same route 53 record?

J. Patwary
  • 427
  • 1
  • 7
  • 22
  • What do you mean by "hostname"? Do you mean a name stored in the OS? Or a DNS Name? Which OS are you using? – John Rotenstein Oct 01 '21 at 00:15
  • Yes, the hostname stored in the OS. I need this to match for a licensing requirement. This is on a Linux machine (rhel) – J. Patwary Oct 04 '21 at 14:16
  • How about: [RHEL 8 Change Hostname (computer name) command - nixCraft](https://www.cyberciti.biz/faq/rhel-8-change-hostname-computer-name-command/) – John Rotenstein Oct 04 '21 at 20:35

1 Answers1

0

You could do this with Route53 using failover routing:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-failover, specifically active-passive failover:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-types.html#dns-failover-types-active-passive-one-resource

Set each ec2's hostname to the same value on both ec2s as detailed here:

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html

This would require both ec2s to be running.

Alternately, you could use EC2 lifecycle events.

https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#ec2_event_type

When you detect that you us-west-1 has experienced a Terminated lifecyle event, you launch your us-east-1 instance via a lambda.

There are almost certainly other solutions.

mcfinnigan
  • 11,442
  • 35
  • 28