简体   繁体   中英

How do I connect up my Amazon EC2 instances without manually modifying config files?

I have a three-tier Windows-based web application bundled into 3 AMIs on Amazon EC2 that I use for load testing.

  • An ASP.NET web application on IIS
  • An .NET application server
  • SQL Server

After I launch them, the config files of each tier needs modifying to update the IP addresses.

At the moment I am doing this manually: I connect to the webserver instance via remote desktop and modify the config file to point to the new IP of the application server instance. Then I do the same with the application server to change the IP in the connection string.

This must be a common requirement and I must be missing something obvious. There must be a better way!

  • I could use Elastic IP addresses, but these machines are only provisioned for a couple of hours at a time, and I would be charged for the addresses when they were NOT in use (which would be most of the time).

  • Is there some way of persistently naming the machines? Can I somehow get all the machines on the same network and use machine names instead of IP addresses?

  • I could write some nifty PowerShell script that would perform the modifications remotely. Is there an example somewhere?

  • I could use a dynamic IP address service . I'm not sure if this would have any negative effect on performance or availability... Are there any downsides to this approach?

  • I could install some sort of self-configuring service on each machine (which connects to S3? SNS? SimpleDB?) to publish/retrieve the addresses of the other machines and update the config files automatically. Is there an example somewhere?

What is best practice?

You could use Amazon Virtual Private Cloud (Amazon VPC) . You have a private subnet where you can assign an IP address to an instance , but it may require launching an instance from command line to assign IP . VPC is charged the same way as EC2.

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