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