Courseiva

SOA-C02 Deployment, Provisioning, and Automation Practice Question

Exhibit

Refer to the exhibit.
```
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain
```

An administrator deploys a CloudFormation template that includes the snippet shown in the exhibit. Later, the administrator deletes the stack. What happens to the S3 bucket?

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 bucket is retained but no longer managed by CloudFormation

The DeletionPolicy attribute set to 'Retain' on the S3 bucket resource causes CloudFormation to preserve the bucket when the stack is deleted. The bucket will still exist in the account but will no longer be under CloudFormation management. Therefore, option D is correct. Option A is incorrect because the bucket is retained regardless of its contents. Option B is incorrect because the bucket is not emptied or deleted. Option C is incorrect because the bucket is not deleted along with the stack.

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 bucket is deleted only if it contains no objects

    Why it's wrong here

    The DeletionPolicy attribute is evaluated before CloudFormation considers the bucket's contents. A Retain policy on an S3 bucket means CloudFormation will not issue a DeleteBucket call during stack deletion, regardless of whether objects exist. Conditional deletion based on emptiness is simply not a behavior that CloudFormation implements when a DeletionPolicy is set to Retain.

  • ✗

    The bucket is emptied and then deleted

    Why it's wrong here

    CloudFormation does not perform a lifecycle action that empties a bucket as part of stack deletion. When the DeletionPolicy is Retain, the stack deletion process skips the bucket entirely, leaving both the bucket and any objects in it untouched. Emptied-and-deleted behavior would occur only with a Delete policy (the default for S3 buckets), not with Retain.

  • ✗

    The bucket is deleted along with the stack

    Why it's wrong here

    A DeletionPolicy: Retain on the bucket resource explicitly overrides the default deletion behavior. Without Retain (or with the default Delete policy), the bucket would be deleted along with the stack, but CloudFormation honors the Retain policy and does not delete the resource. Therefore, the bucket is not removed from the account when the stack is deleted.

  • ✓

    The bucket is retained but no longer managed by CloudFormation

    Why this is correct

    When a CloudFormation stack is deleted, resources with a DeletionPolicy of Retain are left in place in the AWS account. CloudFormation disassociates the resource from the stack, meaning it no longer tracks or manages the bucket through stack operations. The bucket remains fully functional and accessible, but subsequent stack updates or deletions will not affect it.

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 SOA-C02 question is part of Courseiva's 1,169-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 SOA-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 SOA-C02 exam.