bash - Amazon aws user-data python script -


think inside aws server(say x) , launching instance(server)say y,at time of launching server y have pass 'user-data' through parameter of launching server y.i want pass x server pvt ip,and instance id through user data y server.i wrote using python below.

can me make correct?

user_data_script= '#!/bin/bash'+'\n'+'sudo su'+'\n'+'cd '+'\n'+'echo '+"dispatcher_id="+dispatch_id+' >'+'/etc/scripts/id.txt'+'\n'+'echo '+"dispatcher_ip="+dispatch_ip+' >>'+'/etc/scripts/id.txt'+'\n'+'/etc/scripts/publisherpy.sh' 

the above dipatcher_id,ip through metadata,since inside x server

the above code should make inside y server id.txt file:

 dipatcher_id='i-123567by7'    dipatcher_ip='10.45.66.76' 

thank in advanced


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -