Automating ArangoDB on AWS: Installation, S3 Backups, and Systemd Orchestration
These articles are AI-generated summaries. Please check the original sources for full details.
ArangoDB on AWS: Automate Install, S3 Backup & Restore with Systemd
ArangoDB operates as a native multi-model database supporting documents, graphs, and key/value stores through a single query language. Managing this on AWS EC2 requires specific automation for the database process, daily S3 backups, and a tested restore path.
Why This Matters
Technical reality often demands self-hosted multi-model databases on EC2 for specific configuration control, but this lacks the native backup safety of managed services. Implementing systemd timers and automated shell scripts bridges this gap, providing a reliable recovery point objective (RPO) and reducing the risk of human error during manual upgrades or migrations.
Key Insights
- Fact: ArangoDB 3.6.5-1 requires setting vm.max_map_count to 1024000 for optimal memory mapping on Ubuntu 18.04.
- Concept: Multi-model databases consolidate document, graph, and key/value stores into a single query language (AQL) to reduce architectural complexity.
- Tool: Systemd timers provide a robust alternative to cron for scheduling database backup services with calendar-based execution (e.g., daily at 02:30:00).
- Concept: Automated S3 backups using the AWS CLI allow for off-site data durability and point-in-time recovery for self-hosted instances.
- Fact: Updating to ArangoDB 3.12+ on Ubuntu 22.04 requires updating repository URLs, though the core automation scripts for backup and restore remain compatible.
Working Examples
Installation and configuration script for ArangoDB 3.6.5-1 on Ubuntu 18.04.
#!/bin/bash
sudo systemctl stop arangodb3.service
sudo cp -r /etc/arangodb3/ ~/arango-config-backup
curl -OL https://download.arangodb.com/arangodb36/DEBIAN/Release.key
sudo apt-key add - < Release.key
echo 'deb https://download.arangodb.com/arangodb36/DEBIAN/ /' | sudo tee /etc/apt/sources.list.d/arangodb.list
sudo apt-get update
sudo apt-get install arangodb3=3.6.5-1
sudo sed -i "s+endpoint = tcp://127.0.0.1:8529+endpoint = tcp://0.0.0.0:8529+g" /etc/arangodb3/arangod.conf
sudo systemctl enable arangodb3.service
sudo systemctl start arangodb3.service
sudo systemctl status arangodb3.service
sudo sysctl -w "vm.max_map_count=1024000"
ArangoDB backup script with automated compression and S3 upload.
#!/bin/sh
NOWDATE=$(date +%Y-%m-%d)
DIRNAME="Your directory name"
BUCKETNAME="Your bucket name in S3"
DATABASENAME="Your database name"
mkdir -p "/home/ubuntu/backup/$DIRNAME"
arangodump --server.endpoint tcp://127.0.0.1:8529 --server.username root --server.password 'yourpassword' --server.database $DATABASENAME --output-directory "/home/ubuntu/backup/$DIRNAME/" --compress-output --overwrite
tar -czvf /home/ubuntu/backup/$NOWDATE-$DATABASENAME-backup.tar.gz -C /home/ubuntu/backup/$DIRNAME .
aws s3 cp /home/ubuntu/backup/$NOWDATE-$DATABASENAME-backup.tar.gz s3://$BUCKETNAME/dbbackup/
aws s3 rm s3://$BUCKETNAME/dbbackup/$LASTDATE-$DATABASENAME-backup.tar.gz
rm -rf /home/ubuntu/backup/$NOWDATE-$DATABASENAME-backup.tar.gz
rm -rf /home/ubuntu/backup/$DIRNAME/*
Systemd timer configuration for daily backup scheduling.
[Unit]
Description=Schedule ArangoDB backup service
[Timer]
OnCalendar=*-*-* 02:30:00
Unit=backup.service
[Install]
WantedBy=multi-user.target
Practical Applications
- Use Case: AWS EC2 administrators automating ArangoDB lifecycle on Ubuntu 18.04 using systemd units. Pitfall: Neglecting to switch applications to maintenance mode before stopping the service leads to failed queries and potential data inconsistency.
- Use Case: DevOps teams implementing disaster recovery by syncing arangodump tarballs to Amazon S3 for durable off-site storage. Pitfall: Hardcoding plain-text passwords in the backup script string instead of using environment variables or encrypted secret stores.
References:
Continue reading
Next article
Advanced AWS ECR Management: Security Scanning, Lifecycle Automation, and OIDC Integration
Related Content
Automated Linux Database Backups: A Guide for PostgreSQL and MySQL
Learn to automate PostgreSQL and MySQL backups on Linux using bash scripts, cron jobs, and AWS S3 to prevent data loss from bad deploys.
Provisioning AWS Networking with Terraform: A Hands-on Infrastructure as Code Guide
Learn to build a production-ready AWS VPC using Terraform to automate networking with public and private subnets, supporting up to 65,536 addresses.
Post-Mortem: Automated Backups Fail, SII Breathing Down Your Neck
45KB backup file caused 6 months of SII-compliant data loss in Chilean SMEs.