# Is there a way where I can automate backup of questdb using ebs volume running quest db as ami in ec2

**URL:** <https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271>\
**Category:** Community\
**Tags:** storage, question\
**Created:** [December 5, 2024, 4:09pm UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271 "2024-12-05T16:09:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pythonista1291](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@Pythonista1291](https://community.questdb.com/u/Pythonista1291)\
**Post date:** [December 5, 2024, 4:09pm UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/1 "2024-12-05T16:09:24Z")

</div>

I want to either change data storing directory of questdb to a volume or take automated backup to volume using snapshop

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [December 5, 2024, 4:13pm UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/2 "2024-12-05T16:13:52Z")

</div>

You will need to write a script to do this, in your favourite language.

- **change data storing directory for database**
  - stop database
  - copy to a new volume
  - start database

- **change data storing directory for one table**
  - create a new table using `IN VOLUME`
  - copy data from old table to new table
  - drop original table
  - rename new table

- **automated EBS backups**
  - run `CHECKPOINT CREATE`
  - start EBS snapshot
  - wait for EBS snapshot to say `PENDING`
  - run `CHECKPOINT RELEASE`

Then make these processes triggerable by timer or API.

---

<div class="post-metadata">

**Author:** ![Pythonista1291](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@Pythonista1291](https://community.questdb.com/u/Pythonista1291)\
**Post date:** [December 6, 2024, 3:42am UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/3 "2024-12-06T03:42:38Z")

</div>

If I am trying to change the directory by changing cairo.root = some cloud path , copied the contents of directory “questdb” to volume and restarted the db, I was not able to connect to db… is there something I am missing.

Note : using quest db ami

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [December 6, 2024, 9:59am UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/4 "2024-12-06T09:59:59Z")

</div>

What do you mean by ‘some cloud path’? The path needs to be some a mounted disk i.e an EBS volume attached to the EC2 instance.

Please share some screenshots/logs to add some context so we can help you further 🙂

---

<div class="post-metadata">

**Author:** ![Pythonista1291](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@Pythonista1291](https://community.questdb.com/u/Pythonista1291)\
**Post date:** [December 6, 2024, 11:12am UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/5 "2024-12-06T11:12:53Z")

</div>

Yes you are correct I am giving a mounted path example “./mnt/questdb” and issue is solved now as it was access issue.  
Do I need to restart questdb after changing the root directory

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [December 6, 2024, 11:40am UTC](https://community.questdb.com/t/is-there-a-way-where-i-can-automate-backup-of-questdb-using-ebs-volume-running-quest-db-as-ami-in-ec2/271/6 "2024-12-06T11:40:22Z")

</div>

Yes, you should stop QuestDB before relocating it, and then start it again afterwards.
