SAS in AWS: How to maintain same IP and hostname in autoscaling instance

0

HI Team I am installing SAS in EC2 instance. SAS software installation is tied to private IP address and port. I am using autoscaling=1. So when an EC2 instance goes down, I am expecting a new instance should come up. But the hostname and IP address will be different in new EC2 instance. So SAS doesn't work in new instance.

  1. How can I block/reserve private IP address and Hostname in AWS?
  2. How to use the blocked private IP address and Hostname (above) to be used in the new instance that comes through Auto scaling?
2 Answers
1

If you absolutely need the same IP address on the server, one way is to create an Elastic Network Interface and attach that as a second network interface to whatever EC2 instance is currently running. Tell SAS to use this IP address. Note though you want this to be in a different subnet to your primary network interface - if you attach two or more network interfaces from the same subnet to an instance, you may encounter networking issues such as asymmetric routing.

If that's no good, another wierd workaround I've seen is to put your autoscaling group in a small /28 subnet, and consume all addresses EXCEPT ONE with other resources (e.g. ENIs) - that will force your EC2 instance to always have the same IP as it will grab the only free one.

EXPERT
answered a year ago
0

If by AutoScaling=1 you mean there's only ever a single instance, then you can create a Launch Template with an existing ENI on it. The ASG will only ever use that ENI when launching new instances. Since an ENI can only be on a single instance, that ASG can only ever go between 0 and 1 instances.

If your usecase is just fault tolerance (or scaling to 0 during 'off' times, and then back to 1 later), then this solution will work. If you need multiple instances, then the solutions mentioned by "skinsman" where you have a pool of secondary addresses/interfaces that are attached post launch (or a small dedicated subnet) are the only options for the instances themselves to get the same private IPs

AWS
answered a year ago
  • Using ASG, how can I preserve the IP?

  • Is it a single instance ASG? If so, you can use an existing ENI in the launch template. That ENI will have the IP(s) associated with it, and the ENI/IP(s) will be reused each time the ASG launches a replacement instance

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions