Coder Workspace Lifecycle
Understand the complete lifecycle of Coder workspaces from creation to deletion.
Workspace States
Creating
Status: Creating
Duration: 1-2 minutes
What's happening:
- Building container image
- Starting VM
- Initializing environment
- Installing dependencies
⏳ Please wait...
Running
Status: Running
Uptime: 2 hours 15 minutes
Cost: $5.00/hour × 2.25 hours = $11.25 so far
You can:
✓ Edit code
✓ Run commands
✓ Share with team
✓ Auto-stop setting applies
Stopped
Status: Stopped
Last running: 2024-06-12 14:30 UTC
Cost: $0/hour (no charges while stopped)
Data: All saved (can restart anytime)
To restart:
1. Click workspace
2. Click Start
3. Returns to Running state
Deleting
Status: Deleting
Duration: 30 seconds - 1 minute
What's happening:
- Stopping container
- Freeing resources
- Deleting data
⏳ Almost done...
Deleted
Status: Deleted
Effect: Workspace permanently gone
Recovery: Not possible (backup before deleting!)
Charges: Stop immediately
Workspace Lifecycle Flow
graph TD
A["Create Workspace"] --> B["Creating<br/>1-2 min"]
B --> C["Running<br/>━━━━━"]
C -->|Manual Stop| D["Stopping<br/>10 sec"]
C -->|Auto-stop| D
D --> E["Stopped<br/>━━━━━"]
E -->|Start| C
E --> F["Delete"]
F --> G["Deleting<br/>30 sec"]
G --> H["Deleted<br/>Irreversible"]
style A fill:#1f97d4,stroke:#0b5394,stroke-width:2px,color:#fff
style B fill:#ff9900,stroke:#ec7211,stroke-width:2px,color:#fff
style C fill:#13aa52,stroke:#05631b,stroke-width:2px,color:#fff
style D fill:#ff9900,stroke:#ec7211,stroke-width:2px,color:#fff
style E fill:#5e6470,stroke:#2f3235,stroke-width:2px,color:#fff
style F fill:#d13212,stroke:#7d0f00,stroke-width:2px,color:#fff
style G fill:#d13212,stroke:#7d0f00,stroke-width:2px,color:#fff
style H fill:#7d0f00,stroke:#3d0800,stroke-width:2px,color:#fff
Creating Workspaces
Initial Creation
1. Click Create Workspace
2. Choose template
3. Set resources
4. Click Create
5. Status: Creating...
6. ~60-90 seconds later: Running
7. Browser IDE opens
8. Ready to code!
First Start Cost
Workspace: backend-api
Resources: 4 CPU, 8 GB RAM
Cost: $5.00/hour
Created: 14:00
Running: 14:02 (2 min creation time - FREE)
Started coding: 14:03
Setup time (creating) is free. Only pay when running!
Running Workspaces
Monitor Runtime
Workspace Details:
Started: 2024-06-12 14:00 UTC
Running for: 2 hours 30 minutes
Cost so far: $12.50
Auto-stop: 30 minutes after inactivity
Last active: Just now
Staying Productive
Workspace runs while:
- ✓ Editing files (active)
- ✓ Terminal command running (active)
- ✓ Idle but within auto-stop time (running)
Auto-stops after:
- ✗ 30 minutes of no activity (default)
- ✗ No terminal commands
- ✗ No file edits
- ✗ Not accessed
Auto-Stop Mechanism
How It Works
14:00 - Start coding
14:30 - Stop coding, open browser instead
14:32 - No activity for 2 minutes
...continue until 30 min idle...
15:00 - Auto-stop triggered!
Workspace transitions: Running → Stopping → Stopped
Cost: $5.00/hour × 1 hour = $5.00
Adjust Auto-Stop
Change when workspace stops:
Settings → Auto-stop after inactivity
Options:
- 5 minutes (very aggressive)
- 15 minutes (testing)
- 30 minutes (default)
- 1 hour (development)
- Never (always running)
Example: Set to 1 hour if frequently working.
What Counts as Activity?
✓ Active:
- Typing in editor
- Running terminal command
- Saving file
- Opening file browser
✗ Not active:
- Browser tab open, not editing
- Looking at code (no changes)
- Running long process you're watching
- Just terminal output
Stopping Workspaces
Manual Stop
Stop anytime:
1. Click workspace
2. Click Stop
3. Status: Stopping...
4. ~10 seconds later: Stopped
5. All data saved
6. No charges while stopped
What Gets Saved
✓ Saved:
- All files on disk
- Git commits
- Database data
- Terminal history
- Workspace settings
✓ NOT Saved:
- Running processes (stopped)
- Memory state
- Temporary files in /tmp
Restart After Stop
1. Click workspace
2. Click Start
3. Status: Starting...
4. ~30 seconds later: Running
5. Files are there
6. Continue where you left off
Deleting Workspaces
Before Deletion
BACKUP YOUR WORK:
# Push to GitHub
git push origin main
# Or download files
# Or export data
# THEN delete
Delete Process
1. Click workspace
2. Click Delete
3. Confirm deletion
4. Status: Deleting...
5. ~30 seconds: Completely gone
6. No recovery possible!
After Deletion
Workspace: backend-api
Status: Deleted
Available: No longer in your workspace list
Data: Gone forever
Recovery: Not possible
Charges: Stop immediately
Cost Optimization
Running Costs
Example workspace:
- Resource size: 4 CPU, 8 GB RAM
- Hourly rate: $5.00/hour
- Daily usage: 8 hours
- Daily cost: $40
- Monthly cost (20 working days): $800
Reduce Costs
Strategy 1: Use smaller workspaces
Small: 2 CPU, 4 GB RAM = $2.50/hour (50% savings)
Use for: Testing, lightweight work
Full-size: 4 CPU, 8 GB RAM = $5.00/hour (for heavy work)
Strategy 2: Stop when not working
Before: Left running 24/7 = $120/month
After: Stop after 30 min = $40/month (67% savings!)
Strategy 3: Delete unused workspaces
Old workspaces: 3 workspaces × $40/month = $120/month
After cleanup: 1 workspace × $40/month = $40/month
Strategy 4: Combine with SSH
Use browser IDE only for demos
Use SSH for actual development (feels local, still cloud)
Same cost, better experience
Workspace History
View All Your Workspaces
My Workspaces:
Running:
- backend-api (2 hours) - $10 so far
- frontend-app (30 min) - $2.50 so far
Total running: $12.50
Stopped:
- data-analysis (3 days ago)
- legacy-api (1 week ago)
Total this month: $500
Restart Old Workspaces
Find stopped workspace:
- Click workspace
- Click Start
- Restarts in ~30 seconds
- All files still there
- Start coding immediately
Best Practices
Minimize Costs
- ✓ Use appropriate resource size
- ✓ Set reasonable auto-stop time
- ✓ Stop manually when done
- ✓ Delete workspaces you don't use
- ✗ Don't leave running 24/7
- ✗ Don't over-provision resources
Maintain Productivity
- ✓ Keep workspaces organized
- ✓ Name them clearly
- ✓ Delete after project ends
- ✓ Push code to GitHub regularly
- ✓ Share good templates
- ✗ Don't hoard workspaces
- ✗ Don't run outdated workspaces
Track Usage
- Review cost weekly
- Delete unused workspaces
- Optimize resource sizes
- Check auto-stop settings
Related Topics
- Coder Workspaces - Create and manage
- Coder Billing - Understand billing
- System Monitoring - Monitor usage