Each update to the AEM repository creates a new content revision which results in AEM repository growth. To avoid uncontrolled repository growth, old revisions need to be cleaned up to free disk resources. This maintenance functionality is called Revision Cleanup (AKA Compaction). It has been available as an offline routine since AEM 6.0.
From AEM 6.3, an online version of this functionality called Online Revision Cleanup (or Online Compaction) was introduced. Compared to Offline Revision Cleanup where the AEM instance has to be shut down, Online Revision Cleanup can be run while the AEM instance is online. Online Revision Cleanup is turned on by default and it is the recommended way of performing a revision cleanup.
Though Adobe Online compaction is enabled by default and run every day, Adobe still recommends planning for offline compaction at least every 2 months.
Following script will help in automating the compaction maintenance process for AEM services hosted on AWS Cloud Environment.
Shell Script – https://drive.google.com/open?id=1jKmrRJVI7b2B11-_2_YtSvMxhk4bwtoH
Supporting XML file – https://drive.google.com/open?id=13HFbTjWiRzRb_XRe0rE1Nhoz4DcIJjuN