# Packer Configuration

Configure how Atmos executes Packer commands for building machine images, including AMIs, VM images, and container images.

## Configuration

**File:** `atmos.yaml`

```yaml
components:
  packer:
    # Executable to run
    command: packer

    # Base path to Packer components
    base_path: components/packer
```

## Configuration Reference

- **`command`**

  Specifies the executable to run for Packer commands. Defaults to `packer`.

  Examples:
  - `packer` - Use Packer from PATH
  - `/usr/local/bin/packer` - Use specific binary
  - `/usr/local/bin/packer-1.9` - Use specific version
- **`base_path`**

  Directory containing Packer component directories. Supports absolute and relative paths.

  Each subdirectory should contain Packer templates (`.pkr.hcl` files) for building images.

## Component Directory Structure

Packer components follow the same directory structure as other component types:

```
components/
└── packer/
    ├── ami-builder/
    │   ├── main.pkr.hcl
    │   └── variables.pkr.hcl
    └── docker-image/
        ├── main.pkr.hcl
        └── variables.pkr.hcl
```

## Example Configuration

**File:** `atmos.yaml`

```yaml
components:
  packer:
    command: packer
    base_path: components/packer
```

With this configuration, you can run Packer commands through Atmos:

```bash
# Build an AMI
atmos packer build ami-builder -s prod

# Validate a Packer template
atmos packer validate docker-image -s dev
```

## Related Commands

## Related

- [Component Configuration Overview](/cli/configuration/components)
- [Packer Components](/components/packer)
- [Stack Configuration](/cli/configuration/stacks)
