Scripts to install Redis on EC2, generate RDB backups and upload them to S3, and restore them when needed. Includes steps to automate backups with cron.
| Requirement | Details |
|---|---|
| EC2 | Create an instance on AWS EC2 |
| Type | Minimum t3.micro |
| Storage | Minimum 30 GB volume |
| OS | Ubuntu (e.g. 24.04 LTS) |
| Folder | Description |
|---|---|
| 1.InstallRedisDB.Ec2 | Install Redis on the EC2 instance, configuration and checks. |
| 2.GenerateBackup | Script and steps to generate the RDB backup and upload it to an S3 bucket. |
| 3.RestoreBackup | Script and steps to download a backup from S3 and restore Redis. |
- EC2 → Create an instance with the requirements above.
- 1.InstallRedisDB.Ec2 → Install and configure Redis on the instance.
- 2.GenerateBackup → Configure AWS CLI, adjust
generate-backup.sh(bucket, environment) and run it (manually or via cron). - 3.RestoreBackup → When needed, use
restore-backup.shwith the S3 path or local backup folder.
Configure AWS CLI and the script on the instance (see 2.GenerateBackup/README.md), then schedule the script with absolute paths:
| Environment | Frequency | Example crontab |
|---|---|---|
| Production | Daily | 0 5 * * * /full/path/generate-backup.sh >> /var/log/redis-backup.log 2>&1 |
| QA | Weekly (e.g. Friday) | 0 5 * * 5 /full/path/generate-backup.sh >> /var/log/redis-backup.log 2>&1 |
Cron guide on Ubuntu: Crontab.Script.
Generate backup (default environment prd):
./generate-backup.sh # prd
./generate-backup.sh qa # other environmentRestore from S3:
./restore-backup.sh "s3://my-bucket/backups/prd/20250131120000/"Restore from local folder:
./restore-backup.sh /backups/20250131120000 redis-backup-2025-01-31.rdbMore details in each folder’s README.
Scripts para instalar Redis en EC2, generar backups del RDB y subirlos a S3, y restaurarlos cuando haga falta. Incluye pasos para automatizar backups con cron.
| Requisito | Detalle |
|---|---|
| EC2 | Crear instancia en AWS EC2 |
| Tipo | Minimo t3.micro |
| Disco | Volumen minimo 30 GB |
| SO | Ubuntu (p. ej. 24.04 LTS) |
| Carpeta | Descripcion |
|---|---|
| 1.InstallRedisDB.Ec2 | Instalacion de Redis en la instancia EC2, configuracion y comprobaciones. |
| 2.GenerateBackup | Script y pasos para generar el backup RDB y subirlo a un bucket S3. |
| 3.RestoreBackup | Script y pasos para descargar un backup desde S3 y restaurar Redis. |
- EC2 → Crear instancia con los requisitos anteriores.
- 1.InstallRedisDB.Ec2 → Instalar y configurar Redis en la instancia.
- 2.GenerateBackup → Configurar AWS CLI, ajustar
generate-backup.sh(bucket, entorno) y ejecutarlo (a mano o por cron). - 3.RestoreBackup → Cuando haga falta, usar
restore-backup.shcon la ruta S3 o la carpeta local del backup.
Configurar AWS CLI y el script en la instancia (ver 2.GenerateBackup/README.md), luego programar el script con rutas absolutas:
| Entorno | Frecuencia | Ejemplo crontab |
|---|---|---|
| Produccion | Diario | 0 5 * * * /ruta/completa/generate-backup.sh >> /var/log/redis-backup.log 2>&1 |
| QA | Semanal (ej. viernes) | 0 5 * * 5 /ruta/completa/generate-backup.sh >> /var/log/redis-backup.log 2>&1 |
Guia de cron en Ubuntu: Crontab.Script.
Generar backup (entorno por defecto prd):
./generate-backup.sh # prd
./generate-backup.sh qa # otro entornoRestaurar desde S3:
./restore-backup.sh "s3://mi-bucket/backups/prd/20250131120000/"Restaurar desde carpeta local:
./restore-backup.sh /backups/20250131120000 redis-backup-2025-01-31.rdbMas detalles en los README de cada carpeta.
