mardi 2 juin 2015

How do i configure the aws instance ip during the user data configuration?

I have question about passing a shell script to an instance with user data. So what I need to configure here is, since my server is going to run on the instance, before the instance got created, the shell script should configure the server.xml information, (like the instance ip address, database ip addresss...) before starting the instance/server. But, since the instance/server hasn't be generated yet, is there any variable i can use to pass the localhost information in the shell script? is there any way for user to specify some custom variable while running the user data before the instance got created? (before using the aws user data, I used to run it manually, through the configure.sh file and the config.properties file after the instance got created)

#!/bin/bash
# source the properties:
. ./config.properties
echo "Control Center Installation"
echo "Updating server.xml"
echo "Go to the configuration directory"
cd "Server/server/configuration/"
sed -i -s "s/SERVER_IP/"$LOCALHOST_IP"/g" server.xml
sed -i -s "s/DB_IP/"$DATABASE_IP"/g" server.xml
cd "../tomcat/bin"
sh startup.sh




Aucun commentaire:

Enregistrer un commentaire