Issue
I am writing a script, and when I execute this script inside of my RHEL EC2 instance manually, it works as expected.
However, when i am trying to automate using a CloudFormation template (that means putting in a s3 bucket and downloading in user-data from there) it is not running.
I have the following commands in my .bash_profile
sudo sed -e '11 a export ORACLE_HOME=/usr/lib/oracle/12.1/client64' -i /home/ec2-user/.bash_profile
sudo sed -e '12 a export LD_LIBRARY_PATH=$ORACLE_HOME/lib' -i /home/ec2-user/.bash_profile
sudo sed -e '13 a export PATH=$ORACLE_HOME/bin:$PATH' -i /home/ec2-user/.bash_profile
Solution
by elevating the permission of script, it worked.
Answered By - Shubham Jain