# atmos aws cloudformation get template

Fetch the deployed stack's template (`GetTemplate`) and write it to stdout.
By default this is the fully-processed template CloudFormation actually
deployed — the same shape a diff against the local render should compare
against — not the user-submitted source.

> ⚠️ Experimental

## Usage

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

```shell
atmos aws cloudformation get template vpc -s plat-ue2-dev
```

Fetch the original, user-submitted template instead of the processed one:

```shell
atmos aws cloudformation get template vpc -s plat-ue2-dev --original
```

By default the template is re-serialized as pretty-printed YAML, because CloudFormation often stores
the processed template as JSON. With `--original`, Atmos prints the body exactly as CloudFormation
returned it, byte for byte, with comments, quoting, and key order intact, so you can diff it against
your source file:

```shell
atmos aws cloudformation get template vpc -s plat-ue2-dev --original > deployed.yaml
diff template.yaml deployed.yaml
```

A stack that does not exist is an error that points at `atmos aws cloudformation apply`.

## 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`
  .
- **`--original` (optional)**
  Fetch the user-submitted template instead of the processed one CloudFormation deployed, and print it exactly as returned, without re-serializing it.

:::note
`get template` does not fire `before`/`after` hook events — only
[`apply`](/cli/commands/aws/cloudformation/apply),
[`diff`](/cli/commands/aws/cloudformation/diff),
[`delete`](/cli/commands/aws/cloudformation/delete),
[`drift detect`](/cli/commands/aws/cloudformation/drift/detect), and
[`drift describe`](/cli/commands/aws/cloudformation/drift/describe) do.
:::
