Create Collections
Collections are logical groupings of assets that make it easy to manage related infrastructure together.
What Are Collections?
A collection is a named group of assets that you want to manage as a unit:
┌─────────────────────────────────────────────────────────┐
│ Staging Web Tier │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ EC2: API │ │ EC2: Web │ │ ECS: App │ │ RDS: DB │ │
│ │ Server 1 │ │ Server 1 │ │ Service │ │ Primary │ │
│ └──────────┘ └──────────┘ └──────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────┘
When you start or stop a collection, all assets in it are affected together.
Creating a Collection
From the Dashboard
- Go to Infrastructure
- Click New Collection
- Fill in the details:
| Field | Description | Example |
|---|---|---|
| Name | Short, descriptive name | Staging Web Tier |
| Description | Optional longer description | Frontend and API servers for staging |
| Color | Visual identifier | #3B82F6 (blue) |
| Tags | Optional categorization | staging, frontend |
- Click Create Collection
From Asset Selection
- Go to Infrastructure
- Select multiple assets using checkboxes
- Click Add to Collection
- Choose an existing collection or create new
- Confirm
Collection Organization Patterns
By Environment
├── Production # Never managed by NightOps
├── Staging # Business hours only
├── Development # Business hours only
└── QA Testing # On-demand only
By Service Tier
├── Staging
│ ├── Web Tier # Frontend, CDN, load balancers
│ ├── Application Tier # API servers, workers
│ └── Data Tier # Databases, caches
By Team
├── Backend Team Staging
├── Frontend Team Staging
├── Data Team Staging
└── Mobile Team Staging
By Dependency Order
├── Staging Data (start first)
│ └── RDS instances
│ └── ElastiCache
├── Staging Backend (start second)
│ └── API servers
│ └── Workers
└── Staging Frontend (start last)
└── Web servers
└── CDN origins
Adding Assets to Collections
Individual Asset
- Go to Infrastructure
- Click on an asset to open details
- Under Collection, select the target collection
- Save changes
Bulk Add
- Go to Infrastructure
- Use checkboxes to select multiple assets
- Click Add to Collection
- Select the target collection
- Confirm
Auto-Assignment by Tag
Set up automatic collection assignment based on cloud provider tags:
- Go to Settings → Auto-Assignment
- Add a rule:
If tag "environment" equals "staging"
And tag "tier" equals "web"
Then assign to collection "Staging Web Tier" - Save and sync providers
New assets matching the tags will automatically join the collection.
Collection Status
Collections have an aggregate status based on their assets:
| Status | Meaning |
|---|---|
| Running | All assets are running |
| Stopped | All assets are stopped |
| Mixed | Some assets running, some stopped |
| Starting | One or more assets are starting |
| Stopping | One or more assets are stopping |
Collection Actions
Start Collection
Starts all assets in the collection:
- Go to the collection
- Click Start All
- Confirm
Assets start in parallel by default. For ordered startup, see Dependency Management.
Stop Collection
Stops all assets in the collection:
- Go to the collection
- Click Stop All
- Confirm
Refresh Status
- Click Refresh on the collection
- NightOps queries each asset's current state
- Status updates in real-time
Collection Metrics
Each collection displays:
| Metric | Description |
|---|---|
| Resource Count | Number of assets in collection |
| Monthly Cost | Estimated cost if running 24/7 |
| Current Status | Running, stopped, or mixed |
| Last Action | Most recent start/stop and when |
Cost Breakdown
Click on a collection to see cost breakdown by asset:
Staging Web Tier $432.50/month
├── api-server-1 (m5.large) $119.81/month
├── api-server-2 (m5.large) $119.81/month
├── web-server-1 (t3.medium) $30.37/month
├── web-server-2 (t3.medium) $30.37/month
└── app-service (ECS) $132.14/month
Attaching Schedules
Single Schedule
- Edit the collection
- Under Schedule, select from dropdown
- Save changes
All assets follow this schedule automatically.
Multiple Schedules
A collection can only have one schedule, but you can:
- Create sub-collections with different schedules
- Use individual asset schedules for exceptions
Example:
Staging (Schedule: Weekdays 8am-8pm)
├── Core Services
│ └── Always follow collection schedule
└── On-Demand Services (No schedule)
└── Only started manually
Dependency Management
For applications with startup dependencies (database before app, app before web):
Startup Order
- Go to Collection → Settings → Dependencies
- Define startup order:
1. Data Tier (wait 2 minutes)
2. Application Tier (wait 1 minute)
3. Web Tier - Save
When starting the collection, NightOps:
- Starts Data Tier assets
- Waits for them to be healthy (or 2 minutes)
- Starts Application Tier
- Waits for healthy (or 1 minute)
- Starts Web Tier
Shutdown Order
Shutdown happens in reverse order:
- Web Tier stops first
- Application Tier stops
- Data Tier stops last
Health Checks
Configure health checks to know when assets are ready:
# For EC2/VMs
health_check:
type: http
url: http://{{private_ip}}:8080/health
timeout: 30s
interval: 5s
# For databases
health_check:
type: tcp
port: 5432
timeout: 60s
Collection Permissions
Control who can manage each collection using ACL:
| Permission | Description |
|---|---|
| View | Can see collection and assets |
| Start | Can start the collection |
| Stop | Can stop the collection |
| Edit | Can modify collection settings |
| Delete | Can delete the collection |
See Roles & Permissions for details.
Best Practices
Keep Collections Focused
Bad:
Everything Staging # 50 assets, mixed purposes
Good:
Staging API # 5 assets, clear purpose
Staging Workers # 8 assets, clear purpose
Staging Database # 3 assets, clear purpose
Use Consistent Naming
<environment>-<tier>-<region>
Examples:
staging-web-useast
staging-api-useast
dev-all-uswest
Document Dependencies
Add descriptions explaining:
- What services are in this collection
- What depends on this collection
- Startup/shutdown considerations
Test Before Scheduling
- Manually stop the collection
- Wait a few minutes
- Manually start the collection
- Verify everything comes back healthy
- Then attach a schedule
Troubleshooting
Assets Not Starting Together
- Check all assets are in the collection
- Verify no assets have individual schedules overriding
- Check for dependency ordering delays
Collection Shows "Mixed" Status
Some assets may have failed to start/stop:
- Click on the collection
- Look for assets with Error status
- Check the asset's action log for details
- Fix the underlying issue
- Retry the operation
Cost Not Updating
Collection costs are cached and refresh:
- Automatically every 15 minutes
- After any asset sync
- When clicking Refresh
Next Steps
- Configure schedules — Automate collection on/off times
- Add team members — Let your team manage collections
- Set up Slack — Control collections from Slack