Bird
0
0

You wrote this user data script but it does not execute on instance launch:

medium📝 Debug Q6 of 15
AWS - EC2 Fundamentals
You wrote this user data script but it does not execute on instance launch:
echo "Hello" > /home/ec2-user/hello.txt

What is the likely problem?
AThe file path is incorrect
BThe echo command is invalid
CUser data cannot write files
DMissing shebang line (#!/bin/bash) at the start of the script
Step-by-Step Solution
Solution:
  1. Step 1: Check user data script format

    User data scripts must start with a shebang like #!/bin/bash to run properly.
  2. Step 2: Validate commands and paths

    The echo command and file path are valid, so missing shebang is the issue.
  3. Final Answer:

    Missing shebang line (#!/bin/bash) at the start of the script -> Option D
  4. Quick Check:

    User data needs #!/bin/bash to execute [OK]
Quick Trick: Always start user data scripts with #!/bin/bash [OK]
Common Mistakes:
  • Forgetting the shebang line
  • Assuming echo command is wrong
  • Thinking user data can't write files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes