0

Below is my userdata

    #!/bin/bash
    sudo yum update -y
    sudo amazon-linux-extras install nginx1
    sudo systemctl start nginx
    sudo touch /tmp/file2.txt

nginx is installed but not started, I want to understand why it is not started, can someone please help me here.

  • Does this answer your question? [How to check whether my user data passing to EC2 instance is working or not?](https://stackoverflow.com/questions/15904095/how-to-check-whether-my-user-data-passing-to-ec2-instance-is-working-or-not) – Paolo Feb 23 '22 at 18:05
  • 1
    What is in the log file? `/var/log/cloud-init-output.log` – John Rotenstein Feb 23 '22 at 21:18
  • User data scripts are run as the root user, so no need for sudo. – jarmod Feb 23 '22 at 22:39
  • Can you then run it when you log into the machine? – Riz Feb 23 '22 at 22:42
  • some how it is working now, ``` #!/bin/bash yum update -y amazon-linux-extras install nginx1 systemctl start nginx touch /tmp/file2.txt ``` – yogesh thota Feb 24 '22 at 11:28

0 Answers0