Component Archetypes
Component Archetypes are pre-configured variants of a component for specific use cases. Instead of configuring each instance from scratch, you define archetypes like s3-bucket/public, s3-bucket/logging, or s3-bucket/artifacts that encapsulate best practices for that use case.
Archetypes live in the catalog folder alongside component defaults. For actual mixins (reusable fragments like region defaults), see the Mixins pattern.
Use-cases
Use Component Archetypes when:
-
A component has distinct use cases with different configurations (e.g., S3 buckets for logging vs. public content)
-
You want to encode best practices for each use case
-
Teams should pick from approved configurations rather than configuring from scratch
Example: S3 Bucket Archetypes
S3 buckets are a classic example—you rarely want the same configuration for every bucket:
Directory Structure
stacks/
├── catalog/
│ └── s3-bucket/
│ ├── defaults.yaml # Base configuration (abstract)
│ ├── public.yaml # Public website hosting
│ ├── logging.yaml # Log storage
│ └── artifacts.yaml # Build artifacts
└── deploy/
└── prod.yaml
Base Configuration
stacks/catalog/s3-bucket/defaults.yaml
Public Bucket Archetype
For static website hosting:
stacks/catalog/s3-bucket/public.yaml
Logging Bucket Archetype
For centralized log storage:
stacks/catalog/s3-bucket/logging.yaml
Artifacts Bucket Archetype
For CI/CD build artifacts:
stacks/catalog/s3-bucket/artifacts.yaml
Using Archetypes in Stacks
stacks/deploy/prod.yaml
Common Archetype Patterns
| Component | Archetypes |
|---|---|
| S3 Bucket | public, logging, artifacts, data-lake, backups |
| RDS | primary, replica, analytics |
| Lambda | api-handler, scheduled-task, event-processor |
| IAM Role | service-role, cross-account, admin |
When to Use This vs Mixins
| Approach | Location | Best For |
|---|---|---|
| Mixins | stacks/mixins/ | Shared settings (region, stage) that apply to many components |
| Archetypes | stacks/catalog/<component>/ | Pre-configured variants for specific use cases |
Related Patterns
- Mixins - Reusable fragments in the mixins folder
- Component Catalog - Base component defaults
- Abstract Component - Prevent base components from being deployed
- Component Inheritance - Inherit between components