Skip to main content

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

  1. Go to Infrastructure
  2. Click New Collection
  3. Fill in the details:
FieldDescriptionExample
NameShort, descriptive nameStaging Web Tier
DescriptionOptional longer descriptionFrontend and API servers for staging
ColorVisual identifier#3B82F6 (blue)
TagsOptional categorizationstaging, frontend
  1. Click Create Collection

From Asset Selection

  1. Go to Infrastructure
  2. Select multiple assets using checkboxes
  3. Click Add to Collection
  4. Choose an existing collection or create new
  5. 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

  1. Go to Infrastructure
  2. Click on an asset to open details
  3. Under Collection, select the target collection
  4. Save changes

Bulk Add

  1. Go to Infrastructure
  2. Use checkboxes to select multiple assets
  3. Click Add to Collection
  4. Select the target collection
  5. Confirm

Auto-Assignment by Tag

Set up automatic collection assignment based on cloud provider tags:

  1. Go to Settings → Auto-Assignment
  2. Add a rule:
    If tag "environment" equals "staging"
    And tag "tier" equals "web"
    Then assign to collection "Staging Web Tier"
  3. 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:

StatusMeaning
RunningAll assets are running
StoppedAll assets are stopped
MixedSome assets running, some stopped
StartingOne or more assets are starting
StoppingOne or more assets are stopping

Collection Actions

Start Collection

Starts all assets in the collection:

  1. Go to the collection
  2. Click Start All
  3. Confirm

Assets start in parallel by default. For ordered startup, see Dependency Management.

Stop Collection

Stops all assets in the collection:

  1. Go to the collection
  2. Click Stop All
  3. Confirm

Refresh Status

  1. Click Refresh on the collection
  2. NightOps queries each asset's current state
  3. Status updates in real-time

Collection Metrics

Each collection displays:

MetricDescription
Resource CountNumber of assets in collection
Monthly CostEstimated cost if running 24/7
Current StatusRunning, stopped, or mixed
Last ActionMost 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

  1. Edit the collection
  2. Under Schedule, select from dropdown
  3. Save changes

All assets follow this schedule automatically.

Multiple Schedules

A collection can only have one schedule, but you can:

  1. Create sub-collections with different schedules
  2. 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

  1. Go to Collection → Settings → Dependencies
  2. Define startup order:
    1. Data Tier (wait 2 minutes)
    2. Application Tier (wait 1 minute)
    3. Web Tier
  3. Save

When starting the collection, NightOps:

  1. Starts Data Tier assets
  2. Waits for them to be healthy (or 2 minutes)
  3. Starts Application Tier
  4. Waits for healthy (or 1 minute)
  5. Starts Web Tier

Shutdown Order

Shutdown happens in reverse order:

  1. Web Tier stops first
  2. Application Tier stops
  3. 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:

PermissionDescription
ViewCan see collection and assets
StartCan start the collection
StopCan stop the collection
EditCan modify collection settings
DeleteCan 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

  1. Manually stop the collection
  2. Wait a few minutes
  3. Manually start the collection
  4. Verify everything comes back healthy
  5. 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:

  1. Click on the collection
  2. Look for assets with Error status
  3. Check the asset's action log for details
  4. Fix the underlying issue
  5. 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