Registry / storage / backupdbtos3

backupdbtos3

JSON →
library1.5.0jsnpmunverified

Backup Mysql DB to AWS S3. Provides a simple class to create MySQL database backups and store them in AWS S3 using the AWS SDK. Version 1.5.0. Supports automatic scheduling via cron syntax and a webhook feature (Express-based) to trigger backups remotely. Key differentiators: minimal configuration via environment variables, built-in scheduler, optional webhook server. Release cadence appears irregular. Compared to alternatives like mysql-s3-backup or node-cron, this package is less maintained but offers a straightforward wrapper for automated backups.

npm install backupdbtos3
INSTALL
IMPORT
SIG · BACKUPDBTOS3
B
backupdbtos3
storagejavascriptv1.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (class)
import MySqlS3Backup from 'backupdbtos3';
const MySqlS3Backup = require('backupdbtos3');
ESM-only. Default export is the class. Named exports not available.
MySqlS3Backup
import MySqlS3Backup from 'backupdbtos3';
import { MySqlS3Backup } from 'backupdbtos3';
Not a named export; use default import.
class instantiation
const backup = new MySqlS3Backup();
const backup = MySqlS3Backup();
It's a class; must use new keyword.

Shows how to import and run a backup manually using the default class and runBackupProcess method.

import MySqlS3Backup from 'backupdbtos3'; const backup = new MySqlS3Backup(); backup.runBackupProcess() .then((result) => { console.log('Backup process completed successfully.', result); }) .catch((err) => { console.error('Error during backup process:', err); });
Debug
Known issues
breakingEnvironment variables are required: AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_BUCKET_NAME, DB_USER, DB_PASSWORD, DB_NAME. Missing any will cause runtime error.
fix
Ensure all required env variables are set, e.g., via .env file.
affects: >=1.0.0
gotchaThe cron schedule parameter: passing true or no argument does NOT enable default scheduling; only a valid cron string enables it. Passing false disables any scheduling.
fix
To enable scheduling, pass a cron string like '0 2 * * *'. For no scheduling, pass false or omit the argument (but note that omitting still disables it).
affects: >=1.0.0
gotchaThe package uses synchronous child_process.exec for mysqldump; for large databases, this may cause memory issues or timeouts.
fix
Avoid using for very large databases in production without testing. Consider alternative packages that stream backups.
affects: >=1.0.0
deprecatedAWS SDK v2 is used; AWS SDK v3 is now recommended. The package may not be updated for v3.
fix
If you need AWS SDK v3, consider migrating to a different package or updating dependencies manually.
affects: >=1.0.0
gotchaThe webhook port uses a HTTP server (Express) without built-in authentication; exposing it to the internet can be a security risk.
fix
Add authentication middleware or restrict access via firewall/whitelist.
affects: >=1.0.0
Errors
Common errors & fixes
Error: AWS_REGION is not defined
Missing required environment variable AWS_REGION.
fix
Set AWS_REGION in your environment or .env file.
Can't find module 'express'
Express is not installed when webhook feature is used.
fix
Run 'npm install express' or ensure it is in your package.json dependencies.
TypeError: backup.runBackupProcess is not a function
Using default import incorrectly (e.g., named import) or class instantiation missing new.
fix
Use 'import MySqlS3Backup from "backupdbtos3"' and instantiate with 'new MySqlS3Backup()'.
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies
expressoptionalHTTP server for the webhook functionality
Agent activity
55 hits · last 30 days
node
50
Resources
backupdbtos3 — npm install backupdbtos3 · libregistry