Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the internal IP of an instance in an auto-scaling group

I'm using CloudFormation to bring up a single instance in an autoscaling group (MaxSize: 1)

I would like to know how to access the internal IP of that instance so I can assign it a friendly name with Route 53 in the same template.

If it were just a AWS::EC2::Instance it would be easy but it is defined as an autoscaling group so I don't have access to the "PrivateIP" attribute

like image 613
Ivy Avatar asked Dec 09 '13 10:12

Ivy


1 Answers

From CloudFormation, you can't.

Cloud Formation builds your auto scaling group, but it's scaling group itself that is responsible for creating that instance. In some cases, Cloud Formation will have finished creating the stack prior to the scaling group triggering and completing the creation of the instance.

In order to achieve what you want through CloudFormation, you should add an Elastic Load Balancer (ELB) to the front. Then register the ELB address with Route 53, and tie that into the scaling group.

like image 62
Pete - MSFT Avatar answered Oct 21 '22 12:10

Pete - MSFT