Bird
0
0

Given this user data script for an EC2 instance:

medium📝 Predict Output Q13 of 15
AWS - EC2 Fundamentals
Given this user data script for an EC2 instance:
#!/bin/bash
echo "Hello World" > /home/ec2-user/hello.txt

What will happen when the instance starts?
AThe file will be created but empty
BThe instance will fail to start due to syntax error
CNothing happens because user data is ignored
DThe file /home/ec2-user/hello.txt will contain 'Hello World'
Step-by-Step Solution
Solution:
  1. Step 1: Understand user data script execution

    User data scripts run once at instance start and can create files or run commands.
  2. Step 2: Analyze the script effect

    The script writes 'Hello World' into the file /home/ec2-user/hello.txt, so the file will contain that text.
  3. Final Answer:

    The file /home/ec2-user/hello.txt will contain 'Hello World' -> Option D
  4. Quick Check:

    User data script writes file content [OK]
Quick Trick: User data runs at start and executes commands [OK]
Common Mistakes:
MISTAKES
  • Thinking user data runs multiple times
  • Assuming syntax error in simple echo
  • Believing user data is disabled by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes