Clean up idle DMS instances

Opportunity Name:

Clean up idle DMS instances


AWS Resource Type:

AWS Database Migration Service (DMS)


Opportunity Description:

AWS Database Migration Service (DMS) instances incur hourly costs whether or not they are used. This FF identifies DMS instances that have been idle for an extended period of time, creates a backup of each instance’s configuration, and terminates the instances.


Criteria for identifying the opportunity:

An opportunity is identified if the following criteria are met:

  • The instance was created >90 days ago.
  • There is currently no activity on the instance. Any replication tasks associated with the instance must be in one of the following states: 'failed', 'failed-move', 'ready', or 'stopped'.
  • The instance has not run a replication task in the last 90 days.


Potential savings (range in % on annual basis):

This FF will save almost 100% of idle DMS instance costs. There is a negligible cost associated with storing backup files containing the configuration of the terminated instance and its associated tasks on S3. These JSON backup files are typically less than 5KB in size.


What happens when the Fixer is executed?

The Fixer calls the DMS DeleteReplicationTask API to delete each replication task associated with the instance. The API response contains the task configuration, and the Fixer stores this JSON configuration on S3 as a backup.


Next, the Finder calls the DMS DeleteReplicationInstance API to delete the replication instance. The response contains the configuration of the instance, and this configuration is also stored in S3 as a backup.


Location: `cloudfix-fixer-executions<AccountId>`

  • Instances:  `DmsCleanupIdleClusters/<instanceId>/<InstanceId>.json`
  • Tasks: `DmsCleanupIdleClusters/<instanceId>/tasks/<TaskId>.json`


  • `AccountId` is the AWS Account Id
  • `InstanceId` is the ID of the DMS instance
  • `TaskId` is the ID of the DMS task


Is it possible to rollback once CloudFix implements the fixer?

Yes. There is no automated rollback, but rollback can be triggered manually by executing the SSM document "Cloudfix-Runbook-DMSCleanupIdleInstances-rollback-prod" to recreate the DMS instance and (optionally) its associated tasks.


  • ReplicationInstanceConfigKey: The replication instance configuration to create
  • RestoreTasks: Restore previous tasks (true or false)
  • BucketConfigCloudFix: bucket name (see previous section)


Can CloudFix implement the fix automatically once I accept the recommendation?



Does this fix require downtime?



Additional Resources:



Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request