Courseiva
Development with AWS ServiceshardMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A company is using AWS CloudFormation to deploy infrastructure. The developer wants to create a custom resource that runs a Lambda function during stack creation and update. What must the developer do to ensure the custom resource works correctly?

⚠ Common exam trap

It's easy for candidates to assume the Lambda function's return value is automatically captured by CloudFormation, but in reality, the function must explicitly send a response to the pre-signed URL to signal completion.

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

The Lambda function must send a response to an S3 pre-signed URL.

AWS CloudFormation custom resources require the Lambda function to send a response to an S3 pre-signed URL to signal completion. CloudFormation waits for this response to proceed with stack operations; without it, the stack creation or update will time out and fail.

Answer analysis

Option-by-option breakdown

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

  • The Lambda function must send a response to an S3 pre-signed URL.

    Why this is correct

    When a CloudFormation custom resource invokes a Lambda function, CloudFormation provides a unique, time-limited S3 pre-signed URL within the event data. The Lambda function is absolutely required to send a JSON response to this specific URL, indicating the success or failure of the custom resource operation. This response mechanism allows CloudFormation to asynchronously track the status and retrieve any output attributes from the custom resource's execution, which is crucial for stack progression.

  • The Lambda function must be defined in the same CloudFormation template.

    Why it's wrong here

    It is incorrect to state that the Lambda function must be defined within the same CloudFormation template. CloudFormation custom resources, whether AWS::CloudFormation::CustomResource or Custom::*, only require the ServiceToken property to specify the ARN of an existing Lambda function. This function could have been deployed by a separate CloudFormation stack, provisioned manually, or even reside in a different AWS account, provided the necessary invocation permissions are granted.

  • The Lambda function must return a JSON object with the desired output.

    Why it's wrong here

    This statement is incorrect because the Lambda function invoked by a CloudFormation custom resource does not return its output directly as a function return value. Unlike standard synchronous Lambda invocations, CloudFormation expects an explicit HTTP PUT request to the pre-signed S3 URL provided in the initial event. This PUT request's body must contain a JSON payload detailing the operation's status and any desired output attributes, rather than the function simply returning a JSON object.

  • The Lambda function must be written in Python.

    Why it's wrong here

    This assertion is incorrect; the Lambda function for a CloudFormation custom resource is not restricted to Python. AWS Lambda supports a broad range of runtimes, including Node.js, Java, C#, Go, Ruby, and custom runtimes, in addition to Python. Developers have the flexibility to choose any supported language for their custom resource logic, as long as the function correctly implements the custom resource contract by responding to the pre-signed URL.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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 DVA-C02 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 DVA-C02 exam.