Reference
CLI Reference
Complete installation guide, all flags, and usage examples for the awsdac command line interface on macOS, Linux, and Windows.
The CLI is the best fit when diagrams should live with infrastructure code, run in CI/CD, or be generated in automation pipelines. It accepts DAC YAML, Go templates, and CloudFormation templates as input, and outputs PNG, draw.io XML, or PDF.
Recommended: install via npm
npm works on macOS, Linux, and Windows (Node.js 14+ required). It downloads the correct pre-built binary automatically for your OS and CPU architecture.
Install — all platforms via npm
bash
npm install -g awsdac awsdac --version
Install — macOS
bash
# via npm (recommended) npm install -g awsdac # via Homebrew brew install awsdac
Install — Linux
bash
# via npm (recommended) npm install -g awsdac # via Go (requires Go 1.21+) go install github.com/fernandofatech/diagram-as-code/cmd/awsdac@latest # via binary — download and install manually curl -LO https://github.com/fernandofatech/diagram-as-code/releases/latest/download/awsdac-$(curl -s https://api.github.com/repos/fernandofatech/diagram-as-code/releases/latest | grep tag_name | cut -d'"' -f4)_linux-amd64.zip unzip awsdac-*_linux-amd64.zip sudo mv awsdac-*_linux-amd64/awsdac /usr/local/bin/ awsdac --version
Install — Windows
powershell
# via npm (recommended) npm install -g awsdac # via Go (requires Go 1.21+) go install github.com/fernandofatech/diagram-as-code/cmd/awsdac@latest # via binary — download from GitHub Releases, extract and add to PATH: # https://github.com/fernandofatech/diagram-as-code/releases/latest # Download awsdac-vX.Y.Z_windows-amd64.zip # Extract awsdac.exe and add the folder to your PATH
Install — from source
bash
git clone https://github.com/fernandofatech/diagram-as-code.git cd diagram-as-code make build # produces ./awsdac (or awsdac.exe on Windows) # Prerequisites: Go 1.21+
Full flags reference
text
Usage:
awsdac <input filename> [flags]
Flags:
--allow-untrusted-definitions Allow loading definition files from untrusted URLs
-c, --cfn-template [beta] Create diagram from CloudFormation template
-d, --dac-file [beta] Generate DAC YAML from CloudFormation template
--drawio Generate draw.io (.drawio) file instead of PNG
--pdf Generate PDF file instead of PNG
-f, --force Overwrite output file without confirmation
-h, --help help for awsdac
--height int Resize output image height (0 = no resizing)
-o, --output string Output file name (default "output.png")
--override-def-file string Override DefinitionFiles to another URL or local file
-t, --template Process input file as a Go text/template
-v, --verbose Enable verbose logging
--version Print version and exit
--width int Resize output image width (0 = no resizing)Flags quick reference
| Flag | Default | Purpose |
|---|---|---|
| -o, --output | output.png | Output file name |
| --drawio | false | Generate draw.io XML instead of PNG |
| false | Generate PDF instead of PNG | |
| -f, --force | false | Overwrite output without confirmation |
| --width / --height | 0 (off) | Resize PNG/PDF output to exact pixels |
| -t, --template | false | Render input as Go text/template |
| -c, --cfn-template | false | Create diagram from CloudFormation template |
| -d, --dac-file | false | Generate DAC YAML from CloudFormation (use with -c) |
| --override-def-file | — | Use a local or custom URL definition file |
| --allow-untrusted-definitions | false | Allow non-official definition file URLs |
| -v, --verbose | false | Enable verbose logging |
| --version | — | Print installed version |
Usage examples
bash
# Generate PNG (default) awsdac examples/alb-ec2.yaml # Custom output filename awsdac my-architecture.yaml -o my-diagram.png # Force overwrite without confirmation awsdac my-architecture.yaml -o output.png -f # Generate draw.io file awsdac examples/alb-ec2.yaml --drawio -o output.drawio # shortcut: extension infers format automatically awsdac examples/alb-ec2.yaml -o output.drawio # Generate PDF awsdac examples/alb-ec2.yaml --pdf -o output.pdf # Resize output image awsdac examples/alb-ec2.yaml --width 1920 --height 1080 -o output.png # Use a Go template file awsdac examples/tgw-nwfw-tmpl.yaml -t -o output.png # Convert CloudFormation template to diagram awsdac my-cfn-template.yaml -c -o output.png # Convert CloudFormation template to DAC YAML (for further editing) awsdac my-cfn-template.yaml -c -d -o my-diagram.yaml # Verbose logging awsdac examples/alb-ec2.yaml -v # Use a local definition file instead of the remote one awsdac my-diagram.yaml --override-def-file ./my-definitions.yaml # Check version awsdac --version
When to use the CLI
- Local engineering documentation stored next to IaC in version control.
- CI/CD generation of diagrams for pull requests or release artifacts.
- Batch rendering multiple YAML files as part of docs automation.
- CloudFormation template visualization during infrastructure review.
- Exporting draw.io files for manual editing in diagram tools.