I have a simple 2-tier arrangement - one web server (Websphere hosted on windows), and one oracle db server. The web server needs to connect the oracle database server.
I am trying to write a script that
- Brings up a EC2 instance with the Oracle database
- Brings up a EC2 instance with Websphere
- Configures the Websphere instance to communicate to the database
I am stuck at #3. Every time I run the script, the DB server gets a different ip address. How do I tell my Websphere instance "Use this ip address for the DB"?
Some solutions I have considered -
- Configure Websphere to connect to a host name. When the DB server comes up and is assigned an IP Address, update the DNS record (probably Route 53)
- Pass the DB server ip address as user data when launching the websphere instance, and run a startup script to update the configuration
- Use Elastic IP Addresses - but that would require routing db traffic over the internet, right?
Each of these solutions seem more work than usual. Is there something I am missing? What is the standard way to solve this problem?
EDIT for Bounty Elastic IP Address solution works, but I don't like using wasting public ip addresses on servers that should never connect to the internet. I am curious to hear any other solution you have employed to solve this problem.