My user-data script for installing Nginx was found to be working on a new launch of the EC2 instance. After launching the ec2 instance, I further added a PHP installation script by editing the user-data, which doesn't work for me.I am using ubuntu ubutu-20 lts image. what may cause my problem? (I have attached elastic IP to the instance )
Asked
Active
Viewed 449 times
-1
-
Can you share your user_data? – Marcin Mar 09 '22 at 10:57
-
my first data- #!/bin/bash sudo apt update sudo apt-get install nano mkdir /home/ubuntu/logs/ mkdir /home/ubuntu/logs/nginx mkdir /home/ubuntu/public_html sudo apt-get install -y nginx sudo systemctl enable nginx sudo systemctl start nginx – ashique Mar 09 '22 at 11:22
-
after edit userdata- – ashique Mar 09 '22 at 11:22
-
Please update the question with properly formated code blocks. – Marcin Mar 09 '22 at 11:23
-
User data is executed once when you launch a new EC2. Are you launching another EC2 while changing the script? – Riz Mar 09 '22 at 15:59
-
answered here: https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ – Sharuzzaman Ahmat Raslan Mar 10 '22 at 06:20
1 Answers
0
You can reflect your modified script by removing the below file and then reboot the instance:
/var/lib/cloud/instance/sem/config_scripts_user
command to remove:
rm /var/lib/cloud/instance/sem/config_scripts_user

ashique
- 935
- 2
- 8
- 26