Testing and Deployment

A developer must verify that an AWS CDK stack defines an S3 bucket with versioning enabled, without deploying resources. Which test approach should the developer use?

Show the answer

Correct answerB. Assert the bucket properties in the synthesized template

AWhy not this: An unreviewed snapshot establishes a baseline without confirming that versioning is enabled.

BWhy this is right: A resource-property assertion checks the expected versioning configuration without creating the bucket.

CWhy not this: A local function invocation tests handler behavior, not the bucket configuration defined by the stack.

DWhy not this: Template validation does not assert application-specific resource requirements such as enabled versioning.

A CDK fine-grained assertion can check that the synthesized bucket has versioning enabled without deployment. CloudFormation template validation checks template validity, not whether the bucket meets the application's versioning requirement.