# atmos aws cloudformation diff

Preview changes to a deployed CloudFormation stack using a temporary changeset.
Atmos displays the changes and removes the changeset without executing it.
This command authenticates and calls AWS.

> ⚠️ Experimental

**CloudFormation Configuration**

Configure templates, parameters, and delivery targets for your component.
Configuration Reference[Read more](/stacks/components/aws-cloudformation)

## Usage

```shell
atmos aws cloudformation diff <component> --stack <stack> [options]
```

## Examples

```shell
atmos aws cloudformation diff vpc -s plat-ue2-dev
```

Diff all or affected components in dependency order:

```shell
atmos aws cloudformation diff --all -s plat-ue2-dev
atmos aws cloudformation diff --affected --base origin/main
```

Diff components selected by tags or labels:

```shell
atmos aws cloudformation diff --all --tags production,tier-1
atmos aws cloudformation diff --affected --labels cost-center=platform
```

## Arguments

- **`component` (required unless selecting multiple components)**
  CloudFormation component name in the Atmos stack.

## Flags

- **`--stack`, `-s` (required for a single component)**
  Atmos stack. With bulk selection flags, limits the selected components to this stack.

:::note
[`atmos aws cloudformation plan`](/cli/commands/aws/cloudformation/plan) is an alias for `diff`.
Both fire the `before.aws/cloudformation.diff`/`after.aws/cloudformation.diff` hook events.
:::

## Behavior

Atmos deletes the preview changeset after displaying it, including an empty
changeset or a failed render.

### New Stacks

Previewing a new stack creates an empty `REVIEW_IN_PROGRESS` stack. Atmos
removes it after the preview if this invocation created it and it remains in
that state. Stacks that already existed are preserved.

### Failed Stack Creation

A stack in `ROLLBACK_COMPLETE` cannot be updated. The command fails with a hint
to [delete the failed stack](/cli/commands/aws/cloudformation/delete) and apply again.

## Try it out

Requires Docker or Podman, Python 3, and network access for the emulator image. Run against the local AWS emulator; the final commands clean up. No AWS account is needed.

```shell
atmos config set aliases.cft "aws cloudformation"
atmos emulator up aws -s local
atmos cft diff demo -s local
atmos cft delete demo -s local --auto-approve
atmos emulator down aws -s local
```
