Skip to main content
Version: 2.4.1

How to Clean Up Expired Resources

A resource can be tagged with an expiration tag that instructs Resoto to clean it up at a defined time. This can serve as a safety net for when a CI job fails or the IaC tool aborts halfway through its run, or even as the primary means of managing resource lifecycles.


This guide assumes that you have already installed and configured Resoto to collect your cloud resources.


  1. Execute the following command in Resoto Shell to open the Resoto Worker configuration for editing:

    > config edit resoto.worker
  2. Enable cleanup by modifying the resotoworker section of the configuration as follows:

    # Enable cleanup of resources
    cleanup: true
    # Do not actually cleanup resources, just create log messages
    cleanup_dry_run: false
    # How many cleanup threads to run in parallel
    cleanup_pool_size: 16

    When cleanup is enabled, marked resources will be deleted as a part of the collect_and_cleanup workflow, which runs each hour by default.


    Set cleanup_dry_run to true to simulate cleanup without actually deleting resources.

  3. Finally, update the plugin_cleanup_expired section, setting the enabled property to true:

    cleanup_expired plugin configuration
    # Enable plugin?
    enabled: true

The plugin will now run each time Resoto emits the post_cleanup_plan event. The post_cleanup_plan event is a part of the collect_and_cleanup workflow and emitted after resource planning is complete but before the cleanup is performed.

Further Reading