Rollback a Service
This document describes the process for rolling back a backend service to a previous version in case of issues after deployment.
Overview
If a service deployment causes issues in production, you can quickly rollback to a previous stable version using AWS ECS by selecting an earlier task definition.
Rollback Process
1. Access AWS ECS
- Log into AWS Console
- Navigate to ECS (Elastic Container Service)
- Select the appropriate cluster (e.g., production cluster)
- Locate and select the service you want to rollback
2. Update Service Configuration
- Click Update service (top right corner)
- In the Task Definition section, you will see a dropdown
- Select the correct Task Definition revision that corresponds to the version you want to rollback to
- Task definitions are versioned sequentially (e.g.,
service-name:15,service-name:14, etc.) - Each task definition corresponds to a specific release version
- Task definitions are versioned sequentially (e.g.,
- Review the configuration
- Click Update to apply the changes
3. Monitor Rollback
Critical Compatibility Checks
Important
Before rolling back a service, verify compatibility with other components:
Database Compatibility
Does the database version (migrations) fit with the service version you're rolling back to?
- If the current database includes migrations that were added after the version you're rolling back to, the rollback may fail or cause data issues
- Check the migration history for the service
Frontend Compatibility
Does the frontend version fit with the service version you're rolling back to?
- Check if the frontend depends on API endpoints or DTOs that were:
- Added in the version you're rolling back from
- Modified in the version you're rolling back from
- If there's a mismatch, you may need to rollback the frontend as well (see Rollback the Frontend)
Post-Rollback Verification
After rollback completes:
- [ ] Verify the service is running the expected version
- [ ] Check service health and logs
- [ ] Test critical functionality
- [ ] Monitor error rates
- [ ] Confirm the issue is resolved