Download free sample YAML (YAML Ain’t Markup Language) files for DevOps, development, and configuration testing. YAML is the standard configuration format for Kubernetes, Docker Compose, GitHub Actions, Ansible, CI/CD pipelines, and application settings. Our collection includes real-world examples — not generic placeholder data — covering the tools and platforms developers actually use. Every file is free — no sign-up required.
Why use our sample YAML files?
- Real-world config examples: Kubernetes, Docker Compose, GitHub Actions, Ansible, OpenAPI, and more
- Proper YAML syntax with anchors, aliases, multi-line strings, and complex nesting
- Both simple and complex structures for testing at any level
- Includes a deliberately malformed file for error handling testing
- 100% free to download — no account required
- Ideal for testing YAML parsers, linters, config loaders, infrastructure-as-code tools, and CI/CD pipelines
All sample YAML files for download
| File Name | Size | Use Case | Features | Download |
|---|---|---|---|---|
| Basic config | 2 KB | App settings | Scalars, lists, nested maps, multi-line strings | Download |
| Kubernetes deployment | 3 KB | Container orchestration | Multi-doc, labels, probes, resources | Download |
| Docker Compose | 3 KB | Multi-container apps | Services, volumes, networks, health checks | Download |
| GitHub Actions workflow | 4 KB | CI/CD pipeline | Jobs, matrix strategy, caching, deploy | Download |
| Ansible playbook | 4 KB | Infrastructure automation | Tasks, handlers, variables, tags | Download |
| OpenAPI spec (Swagger) | 9 KB | API documentation | Paths, schemas, $ref, auth, responses | Download |
| Anchors and aliases | 3 KB | YAML advanced features | & anchors, * aliases, << merge keys | Download |
| Multi-document | 3 KB | Multiple YAML docs in one file | — separators, … end marker | Download |
| Complex nested data | 4 KB | Deep nesting stress test | 5+ levels, mixed types, Unicode, flow syntax | Download |
| Malformed YAML | 3 KB | Error handling testing | 10 intentional syntax errors | Download |
Browse sample YAML files by category
By platform / tool
- Kubernetes — Deployment + Service manifest with probes, resources, and ConfigMap mounts
- Docker Compose — 4-service stack (web, API, PostgreSQL, Redis) with health checks and networks
- GitHub Actions — CI/CD workflow with lint, matrix testing, Docker build, and conditional deploy
- Ansible — Web server provisioning with Nginx, Node.js, UFW firewall, and fail2ban
- OpenAPI / Swagger — REST API spec with users and orders endpoints, JWT auth, and reusable schemas
By YAML feature
- Basic syntax — Scalars, sequences, mappings, comments, literal and folded block strings
- Anchors & aliases — DRY patterns with & anchors, * aliases, and << merge keys across environments
- Multi-document — Four separate YAML documents in one file with — and … markers
- Complex nesting — 5+ levels deep, Unicode, flow syntax, type coercion edge cases
- Malformed — 10 intentional errors including tabs, duplicate keys, and the Norway problem
Sample YAML file details
1. Basic config
Size: 2 KB
Use case: Application settings
Description: A realistic YAML application config demonstrating fundamental syntax — string, number, boolean, and null scalars, sequences (lists), nested mappings (dictionaries), inline comments, multi-line strings using | (literal block) and > (folded block) styles, and flow-style inline notation ({key: value} and [item1, item2]). Covers app settings, database, cache, CORS, feature flags, and logging. The ideal starting file for testing basic YAML parsing.
2. Kubernetes deployment
Size: 3 KB
Use case: Container orchestration
Description: A Kubernetes Deployment and Service manifest in a single multi-document YAML file (separated by ---). The Deployment includes 3 replicas, container image with pull policy, resource requests/limits (CPU and memory), environment variables from Secrets and ConfigMaps, liveness and readiness probes, rolling update strategy, and volume mounts. The Service exposes the deployment on port 80 via ClusterIP. Use this to test Kubernetes YAML parsing, kubectl apply --dry-run=client validation, and infrastructure-as-code workflows.
Download Kubernetes Deployment
3. Docker Compose
Size: 3 KB
Use case: Multi-container applications
Description: A Docker Compose file defining a 4-service application stack — Nginx reverse proxy, Node.js API server, PostgreSQL database, and Redis cache. Includes named volumes for persistent data, frontend and backend networks (with the backend marked as internal), environment variables with fallback defaults, health checks on every service, dependency ordering with condition: service_healthy, resource limits, and port mappings. Use this to test docker compose config validation and container orchestration workflows.
4. GitHub Actions workflow
Size: 4 KB
Use case: CI/CD pipeline
Description: A GitHub Actions workflow with four jobs: lint/typecheck, test with a matrix strategy (3 Node.js versions × 2 operating systems with exclusions), Docker image build with layer caching, and a conditional deployment job with environment protection. Includes a PostgreSQL service container for integration tests, npm dependency caching, coverage artifact uploads, workflow_dispatch manual triggers with input choices, and secret references. Use this to test GitHub Actions YAML parsing and CI/CD configuration.
Download GitHub Actions Workflow
5. Ansible playbook
Size: 4 KB
Use case: Infrastructure automation
Description: An Ansible playbook for provisioning a web server from scratch — installing system packages, creating application users, setting up Node.js from NodeSource, deploying Nginx with a templated site configuration, configuring UFW firewall rules (SSH, HTTP, HTTPS), setting up fail2ban for intrusion prevention, deploying application files with rsync, and running a health check verification. Includes variables, handlers (restart on config change), tags for selective execution, and conditional task registration. Use this to test Ansible YAML parsing, ansible-lint validation, and infrastructure-as-code workflows.
6. OpenAPI specification (Swagger)
Size: 9 KB
Use case: API documentation
Description: An OpenAPI 3.0 specification defining a sample REST API with user and order management endpoints. Includes GET/POST operations with path parameters, query parameters (pagination, filtering, sorting), request body schemas, response definitions using $ref references to reusable component schemas, JWT Bearer authentication, multiple server definitions (production, staging, localhost), and standard error responses (400, 401, 404, 429 with Retry-After header). Use this to test OpenAPI/Swagger parsers, documentation generators (Swagger UI, Redoc), and API code generation tools.
7. Anchors and aliases
Size: 3 KB
Use case: YAML advanced features
Description: Demonstrates YAML anchors (&), aliases (*), and merge keys (<<) for DRY configuration. Defines database, logging, and retry defaults once, then reuses and selectively overrides them across development, staging, and production environments. Also demonstrates alias-only references (no merge) for notification channel routing across alert severity levels. This is one of the most commonly mishandled YAML features — many parsers handle basic YAML but fail on anchors and merge keys.
8. Multi-document
Size: 3 KB
Use case: Multiple YAML documents in one file
Description: A single file containing four separate YAML documents separated by --- markers: an application config, a user directory, infrastructure settings (database, cache, queue), and project metadata. Includes an explicit document end marker (...). Use this to test multi-document YAML parsing — yaml.safe_load_all() in Python, YAML.LoadAll() in Go, or iterating through document streams in other languages.
9. Complex nested data
Size: 4 KB
Use case: Deep nesting stress test
Description: A comprehensive parser stress test with 5+ levels of nesting (organization → departments → teams → members → skills → databases), mixed data types (strings, integers, floats, booleans, nulls, dates, timestamps), sequences within mappings within sequences, multi-line strings (literal and folded), Unicode characters (Japanese, Korean, German, Hindi, Portuguese), flow-style inline syntax, scientific notation, and type coercion edge cases (.inf, .nan, !!str yes, hex/octal values). Use this to verify complete YAML spec compliance.
10. Malformed YAML
Size: 3 KB
Use case: Error handling testing
Description: A deliberately malformed YAML file with 10 intentional errors: tab indentation (YAML requires spaces only), inconsistent indentation within a block, duplicate keys, unclosed quoted strings, missing space after colon, the Norway problem (NO interpreted as boolean false), colons in unquoted values, mixed indentation depths, undefined anchor references, and invalid document separators. Each error is documented with a comment. Use this to test parser error handling, error message quality, and recovery strategies.
How to use these sample YAML files
- Click the “Download” button next to the file you need.
- Save the YAML file to your device.
- Open in a code editor (VS Code, Sublime Text), or use directly with the target tool (
kubectl apply,docker compose config,ansible-playbook). - Use for testing YAML parsers, config loaders, linters (
yamllint), infrastructure-as-code tools, or CI/CD pipeline validation.
Note: These sample YAML files are free to download and use for testing, development, and educational purposes. For commercial use, please provide proper attribution.
Download sample data in other formats
- Sample JSON files — Structured data for API testing, config, and data exchange
- Sample XML files — Markup data for parsing, validation, and XSLT transformation
- Sample CSV files — Tabular data for spreadsheet and database import testing
- Sample SQL files — Database files for SQL testing
FAQs about sample YAML files
What is the difference between YAML and JSON?
YAML and JSON are both data serialization formats, but YAML prioritizes human readability with indentation-based structure and no brackets, while JSON uses braces and brackets for machine-friendly parsing. YAML supports comments, multi-line strings, anchors/aliases, and multiple documents per file — features JSON lacks. YAML is a superset of JSON, meaning valid JSON is also valid YAML. YAML is preferred for configuration files (Kubernetes, Docker, CI/CD), while JSON is preferred for APIs and data exchange.
What is the difference between .yaml and .yml extensions?
There is no difference — both extensions refer to the same YAML format. The .yaml extension is officially recommended by the YAML specification, but .yml is widely used (particularly in Docker Compose, Ruby on Rails, and some CI/CD tools) due to the historical three-character extension convention. Both are equally valid and interchangeable.
Why is indentation so important in YAML?
YAML uses indentation (spaces only, never tabs) to define structure — unlike JSON which uses braces and brackets. Incorrect indentation changes the meaning of the data. For example, a key indented under another key becomes its child rather than its sibling. This is the most common source of YAML errors. Always use consistent indentation (typically 2 spaces) and never mix tabs with spaces. YAML linters like yamllint can catch indentation errors before they cause runtime failures.
What are YAML anchors and aliases?
Anchors (&name) mark a node for reuse, and aliases (*name) reference that node elsewhere in the file. Merge keys (<<: *name) merge an anchored mapping into another mapping. This enables DRY (Don’t Repeat Yourself) configuration — for example, defining database connection defaults once and reusing them across development, staging, and production sections with selective overrides. Our anchors-and-aliases sample file demonstrates all three patterns.
What is the Norway problem in YAML?
The “Norway problem” is a well-known YAML gotcha: the country code NO for Norway is interpreted as boolean false by YAML 1.1 parsers, because YAML treats unquoted yes, no, on, off, true, and false as booleans. The fix is to quote the value: "NO". YAML 1.2 reduced this ambiguity by only treating true and false as booleans, but many parsers still use YAML 1.1 rules. Our malformed YAML file includes this edge case for testing.
Can I use these YAML files with Kubernetes and Docker?
Yes — the Kubernetes deployment and Docker Compose files are realistic, syntactically valid configurations that follow the actual API schemas expected by these tools. The Kubernetes manifest can be validated with kubectl apply --dry-run=client -f kubernetes-deployment.yaml, and the Docker Compose file with docker compose config. You’ll need to modify image names and credentials for actual deployment, but the structure and syntax are production-ready.
Are these YAML files safe to download?
Yes, all sample YAML files on this page are clean, verified, and safe. They are plain text files containing only configuration data — no scripts, no executable code, and no external references. The Kubernetes and Docker files reference placeholder image names (e.g., myregistry.example.com/sampleapp:2.5.1) that do not point to real containers.