AWS - EC2 FundamentalsWhich of the following is the correct syntax to include a user data script in an EC2 launch configuration?AUserData: "instance metadata access script"BUserData: "curl http://169.254.169.254/latest/meta-data/"CUserData: "#!/bin/bash\necho Hello World > /home/ec2-user/hello.txt"DUserData: "aws ec2 describe-instances"Check Answer
Step-by-Step SolutionSolution:Step 1: Identify user data script formatUser data scripts start with a shebang like #!/bin/bash and contain shell commands.Step 2: Check the example commandsOnly UserData: "#!/bin/bash\necho Hello World > /home/ec2-user/hello.txt" shows a valid bash script writing to a file.Final Answer:UserData: "#!/bin/bash\necho Hello World > /home/ec2-user/hello.txt" -> Option CQuick Check:User data = bash script with #!/bin/bash [OK]Quick Trick: User data scripts start with #!/bin/bash for Linux instances [OK]Common Mistakes:MISTAKESPutting metadata commands in user dataUsing AWS CLI commands directly in user data without contextWriting plain text instead of script
Master "EC2 Fundamentals" in AWS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More AWS Quizzes AWS Account and Billing - Free tier usage monitoring - Quiz 12easy AWS CLI - Configuring credentials - Quiz 13medium AWS CLI - Configuring credentials - Quiz 4medium EC2 Fundamentals - EC2 pricing models (on-demand, reserved, spot) - Quiz 1easy Identity and Access Management - Managed vs inline policies - Quiz 9hard Identity and Access Management - Assuming roles for temporary access - Quiz 11easy S3 Fundamentals - S3 storage classes (Standard, IA, Glacier) - Quiz 13medium S3 Fundamentals - S3 versioning - Quiz 1easy VPC Fundamentals - Internet Gateway for public access - Quiz 13medium VPC Fundamentals - Why VPC provides network isolation - Quiz 8hard