Courseiva
MigrationeasyMultiple ChoiceObjective-mapped

PAS-C01 Migration Practice Question

Exhibit

Refer to the exhibit.

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "MyEC2Instance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "ImageId": "ami-12345678",
        "InstanceType": "t2.micro"
      }
    }
  }
}

Refer to the exhibit. A CloudFormation template is used to migrate a web server to AWS. The template launches an EC2 instance but does not install the web server. What is the best way to automate the installation?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Add a UserData property to the EC2 instance resource.

The UserData property in a CloudFormation EC2 resource allows you to specify scripts or commands that run automatically at instance launch. This is the simplest and most direct method to install software like a web server during provisioning. Option A (CloudWatch Events triggering Lambda) is not automatic at launch and requires additional resources. Option C (Run Command) requires manual invocation or scheduling, not automatic at launch. Option D (CodeDeploy) requires an agent to be pre-installed, which is not the case here.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Create a CloudWatch Events rule to trigger a Lambda function after instance launch.

    Why it's wrong here

    Creating a CloudWatch Events rule to trigger a Lambda function is unsuitable for initial web server installation because Lambda does not directly execute commands within a newly launched EC2 instance. This approach requires additional mechanisms like SSM Agent and Run Command for remote execution, which are not implicitly part of this solution. It is tempting because CloudWatch Events can react to EC2 state changes, making it ideal for post-launch operational tasks such as sending notifications, enforcing tagging policies, or initiating external management processes, rather than direct instance provisioning.

  • Add a UserData property to the EC2 instance resource.

    Why this is correct

    UserData runs scripts during instance initialization.

  • Use AWS Systems Manager Run Command to install the web server.

    Why it's wrong here

    Run Command is manual or requires a schedule, not automatic at launch.

  • Use AWS CodeDeploy to deploy the web server after the instance is created.

    Why it's wrong here

    CodeDeploy requires the CodeDeploy agent on the instance.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

One of 1,616 original PAS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PAS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PAS-C01 exam.