A Minimum Viable CloudFormation Template

Watching the clouds form

Sometimes when testing CloudFormation features I need a minimum viable template to try that feature with.

(Like my Ansible Minimum Viable Playbook).

Here’s the basic template I use:

AWSTemplateFormatVersion: 2010-09-09

    Type: AWS::SNS::Topic

It has two things:

I can then change it according to what I want to test, for example adding parameters, outputs, or referencing resources. This is easier and faster than testing as part of a larger CloudFormation template.

Testing a Bug

As an example, I used this template to test for an old bug.

Previously, if you changed a template to only add a DeletionPolicy to a resource, CloudFormation would succeed but not actually add the policy. Then if you deleted the stack, CloudFormation would delete the resource, even though you thought it wouldn’t.

I tested this in a minute with my MVP template. I created a stack from the above basic template, then updated it with this template:

AWSTemplateFormatVersion: 2010-09-09

    DeletionPolicy: Retain  # Added
    Type: AWS::SNS::Topic

The I deleted the stack and SNS retained the topic.

Nice to know AWS have fixed the bug, although I don’t recall it ever being publicly acknowledged, or mentioned on the release history.


Hope this helps you with testing CloudFormation!


If your Django project’s long test runs bore you, I wrote a book that can help.

Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Related posts:

Tags: ,