简体   繁体   中英

Point EC2 public IP address to subdomain

I want to point a subdomain to an EC2 and I don't want to use Elastic IP and every time I start/stop the instance I want my subdomain point to the new Instance public IP address.

The easiest method is to use an Elastic IP address . It will remain attached to the instance and will not change. There is no additional charge for an Elastic IP address if it is attached to a running instance.

Alternatively, you could configure the operating system running on the instance to run a script whenever the instance starts. The script can update the DNS entry for the current public IP address associated with the instance . If you are using Amazon Route 53 for DNS, then you can make an API call that updates the A-Record to the current IP address being used by the instance.

I suspect it could be done with the change-resource-record-sets command in the AWS CLI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM