# atmos aws cloudformation fmt

Format the component's local template in place: a dependency-free, native
round-trip through the YAML parser that re-serializes the template with
consistent indentation, preserving comments and key order. There is no
`cfn-format` binary to shell out to (Rain's own formatter is archived along
with the rest of Rain), so this is entirely native.

> ⚠️ Experimental

## Usage

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

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

Check whether the template is formatted without writing changes (for CI):

```shell
atmos aws cloudformation fmt vpc -s plat-ue2-dev --check
```

Format all or affected components' templates in dependency order:

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

## Flags

- **`--stack`, `-s` (required for a single component)**
  Atmos stack. Required when operating on a single component; optional (and used only to narrow the selected set) with 
  `--all`
  /
  `--affected`
  .
- **`--check` (optional)**
  Report whether the template is formatted without writing changes. Exits non-zero if the template is not formatted — use this in CI instead of the default write-in-place behavior.
- **`--all` (optional)**
  Format all 
  `aws/cloudformation`
   components' templates in dependency order.
- **`--affected` (optional)**
  Format affected 
  `aws/cloudformation`
   components' templates and their dependencies.
- **`--include-dependents` (optional)**
  With 
  `--affected`
  , include dependent 
  `aws/cloudformation`
   components.
- **`--tags` (optional)**
  Filter by tags (comma-separated, matches any): 
  `--tags=production,tier-1`
  . Composes with 
  `--all`
  /
  `--affected`
   to narrow the selected set further; cannot be combined with a single component argument.
- **`--labels` (optional)**
  Filter by labels (comma-separated 
  `key=value`
   or 
  `key:value`
   pairs, matches all): 
  `--labels=cost-center=platform,compliance=sox`
  . Composes with 
  `--all`
  /
  `--affected`
  /
  `--tags`
  ; cannot be combined with a single component argument.

:::note
`fmt` never calls the CloudFormation API and does not fire `before`/`after`
hook events — only [`apply`](/cli/commands/aws/cloudformation/apply),
[`diff`](/cli/commands/aws/cloudformation/diff), and
[`delete`](/cli/commands/aws/cloudformation/delete) do.
:::
