# atmos aws cloudformation apply

Create or update the CloudFormation stack for a component: create (or reuse)
a changeset and execute it. After a successful apply, Atmos applies the
component's `stack_policy` (if set) and renders the stack's Outputs — the
same view [`output`](/cli/commands/aws/cloudformation/output) renders on
demand.

> ⚠️ Experimental

## Usage

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

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

Skip the interactive confirmation prompt:

```shell
atmos aws cloudformation apply vpc -s plat-ue2-dev --auto-approve
```

Apply all or affected components in dependency order:

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

Apply components filtered by tags or labels (composes with `--all`/`--affected` to narrow the selected set further):

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

## 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`
  .
- **`--target` (optional)**
  Provision target to deliver to. Defaults to 
  `provision.default`
  , otherwise the implicit direct-deploy target.
- **`--auto-approve` (optional)**
  Skip the interactive confirmation prompt. Without it, 
  `apply`
   prompts for confirmation on a TTY before executing the changeset.
- **`--all` (optional)**
  Apply all 
  `aws/cloudformation`
   components in dependency order.
- **`--affected` (optional)**
  Apply affected 
  `aws/cloudformation`
   components and their dependencies.
- **`--base` (optional)**
  Git base ref or SHA to compare against for affected detection: 
  `--base origin/main`
  . Used with 
  `--affected`
  .
- **`--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
[`atmos aws cloudformation deploy`](/cli/commands/aws/cloudformation/deploy) is an alias for `apply`
that defaults `--auto-approve` to `true`. Both fire the
`before.aws/cloudformation.apply`/`after.aws/cloudformation.apply` hook events.
:::
