AEM Developers, raise your hand if you’ve never broken a local AEM instance. If you did raise your hand, you just might be the most diligent AEM developer out there! Full disclosure, I break my local AEM instances more times than I can count, and usually, I have to redo my local AEM setup.
My manual AEM setup steps include:
- Redeploy dependencies (ACS commons/connectors/code and content packages)
- Setup replication agents
- Setup integrations (such as dynamic media)
- <insert other manual tasks here>
Every time I break an AEM instance, it’s a major inconvenience and that’s why I wrote AEM Backup CLI. In this post, I will explain how to use it and provide some additional details.
What is AEM Backup CLI
It is a tiny Command Line Interface that packages the AEM
crx-quickstart folder so that we can restore it when needed. Everything you set up on an AEM instance is inevitably stored in the filesystem under the
crx-quickstart folder, which makes it extremely easy to backup the whole instance. The only caveat, you have to do a backup while your AEM instance is stopped. Which is not bad since you’ll be doing this for local development only.
Installing AEM Backup CLI
- If you don’t have it already installed, install Node.js and grab the LTS version
- Next, install the CLI:
npm install -g aem-backup-cli
- You should now be able to run
aemband see the artwork (screenshot below)
exitto exit out of the CLI for now.
Before You Backup
Let’s cover some ground rules:
- You should only run
aembonce you are in the AEM directory. (the directory that contains the AEM jar and the
- You should only run
aembafter your AEM instance has been completely shutdown. (see: https://github.com/ahmed-musallam/aem-backup-cli#how-it-works)
Your First Backup
Okay, so now that we’ve covered the ground rules, let’s perform a backup!
Let’s say that I have already installed all my packages and configured everything on my local author instance. And then let’s say that my local author instance is located at
/Users/admed.musallam/Development/AEM/6.4. Now, I shutdown my instance and run:
Now I can use any of the
aemb commands, you can see those by typing
backup initial-backup-2019.1.24. I named this backup
initial-backup-2019.1.24, but you can name it whatever you want. You can also create multiple backups (with different names).
So now you have a backup of the whole AEM instance! This process takes ~7 seconds on my 2014 MackbookPro 2.5GHz Core i7 – 16GB RAM..
Restoring Your Backup
Follow the same steps above but stop your AEM instance,
cd into your AEM directory, and run
And this time, type
restore. You will be prompted to select a backup from a list of backups. I went ahead and created 2 other backups:
I selected my original backup and replied
y at the prompt:
My backup is now restored and I can start my AEM instance!
The CLI includes two other commands you can use
list and they are self-explanatory.
Read the documentation to understand how the tool works. Since the tool archives the whole
crx-quickstart folder, and adds the archives under
crx-quickstart.backups, you can copy any of the generated archives and paste them in a different AEM instance folder (under
crx-quickstart.backups. You should be able to use the tool in the same way with the new instance.
- You want to copy a certain backup to another AEM instance on your machine
- You want to share an AEM backup archive with your fellow developers to get started quickly (granted you have a way to share a ~3GB file)
Hope you like the tool and use it in your projects. Please star the repo if you thought it was helpful!
Ahmed is an Adobe Technical Lead and expert in the Adobe Experience Cloud.