nerdexam
Amazon

SOA-C02 · Question #566

A company has created an AWS CloudFormation template that consists of the AWS::EC2::Instance resource and a custom CloudFormation resource. The custom CloudFormation resource is an AWS Lambda…

The correct answer is A. Add a DependsOn attribute to the custom resource. Specify the EC2 instance in the DependsOn. See the full explanation below for the reasoning.

Submitted by takeshi77· Mar 30, 2026Deployment, Provisioning, and Automation

Question

A company has created an AWS CloudFormation template that consists of the AWS::EC2::Instance resource and a custom CloudFormation resource. The custom CloudFormation resource is an AWS Lambda function that attempts to run automation on the Amazon EC2 instance. During testing, the Lambda function fails because the Lambda function tries to run before the EC2 instance is launched. Which solution will resolve this issue?

Options

  • AAdd a DependsOn attribute to the custom resource. Specify the EC2 instance in the DependsOn
  • BUpdate the custom resource's service token to point to a valid Lambda function.
  • CUpdate the Lambda function to use the cfn-response module to send a response to the custom
  • DUse the Fn::If intrinsic function to check for the EC2 instance before the custom resource runs.

How the community answered

(21 responses)
  • A
    76% (16)
  • B
    5% (1)
  • C
    14% (3)
  • D
    5% (1)

Topics

#CloudFormation#Resource Dependencies#Custom Resources#Automation

Community Discussion

No community discussion yet for this question.

Full SOA-C02 Practice