0

We are looking to migrate to AWS in the start of the new year.

One of the issues we have is the fact that some of the applications that we will be migrating over have been configured with hardcoded IP addresses (DB Hostnames).

We will be using ELB's to fully utilise the elasticity and dynamic nature of AWS for our infrastructure. With this in mind, those IP addresses that were static before will now be dynamic (so frequently assigned new IPs).

What is the best approach to solving these hardcoded values? In particular IP addresses? I appreciate usernames, passwords etc. can be placed into a single config file and called using ini function etc.

I think one solution could be: 1) To make an AWS API call to query what the IP address of the host is? Then call the value that way.

Appreciate any help with this!

MrRobot
  • 13
  • 5
  • Are you planning to use RDS or EC2 based database? Why would you be using ELB for database connection? Ideally. Database end point will be only one and I dont find a reason for you to worry about dynamic DB hostnames. – Nans Jan 04 '18 at 17:15

1 Answers1

0

You should avoid hard code IP addresses, and use the hostname for the referenced resource. With either RDS or a self hosted DB running on EC2, you can use DNS to resolve the IP by host name at run time.

Assuming you are using CodeDeploy to provision the software, you can use the CodeDepoly Lifecycle Event Hooks to configure the application after the software as been installed. And after install hook could be configured to retrieve your application parameters, and make them available to the application before it starts.

Regarding the storage of application configuration data, consider using the AWS Parameter Store. Using this as a secure and durable source of application configuration data, you can retrieve the DB host address and other application parameters at software provision time, using the features of CodeDeploy mentioned above.

Rodrigo Murillo
  • 13,080
  • 2
  • 29
  • 50