Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jalmargyyk/ripe-updater/llms.txt

Use this file to discover all available pages before exploring further.

Before RIPE Updater overwrites or deletes any object in the RIPE database, it fetches the current object and saves it as a JSON file in S3. This happens unconditionally — even if the subsequent RIPE operation fails — so you always have a point-in-time snapshot of what was in RIPE DB before any change. Backups are the primary recovery path if a prefix is removed from RIPE DB and needs to be restored manually.

Enabling S3 backups

Set S3_BACKUP=yes along with the four connection variables. Without S3_BACKUP=yes, the feature is disabled and no objects are saved.
VariableDescription
S3_BACKUPSet to yes to enable. Default: no
S3_ENDPOINT_URLFull URL of your S3 endpoint (e.g. https://s3.example.com)
S3_ACCESS_KEYAccess key for your S3 storage
S3_SECRET_ACCESS_KEYSecret access key for your S3 storage
S3_BUCKETBucket name where backup files are stored
S3_BACKUP=yes
S3_ENDPOINT_URL=https://s3.example.com
S3_ACCESS_KEY=myaccesskey
S3_SECRET_ACCESS_KEY=mysecretaccesskey
S3_BUCKET=ripe-backups
On startup, BackupManager connects to S3 and creates the bucket if it does not already exist. If the bucket already exists, startup continues normally.
RIPE Updater uses the boto3 library and is compatible with any S3-compatible object store — AWS S3, MinIO, Ceph, Cloudflare R2, and others. Set S3_ENDPOINT_URL to point at your storage provider’s endpoint.

Backup file naming

Each backup file is named after the prefix it represents. Forward slashes in the prefix are replaced with underscores so the filename is safe for S3 object keys:
prefix_{prefix.replace('/', '_')}.json
For example:
PrefixBackup filename
192.0.2.0/24prefix_192.0.2.0_24.json
2001:db8::/32prefix_2001:db8::_32.json
The backup is created by backup_ripe_object() inside RipeObjectManager.__init__(), which runs before any RIPE API write:
def backup_ripe_object(self):
    filename = f"prefix_{self.prefix.replace('/', '_')}.json"

    ripe_object = self.get_old_object()
    if ripe_object:
        self.logger.info(f'saving ripe object {filename}')
        self.backup.put(filename, json.dumps(ripe_object))
If no object currently exists in RIPE DB for that prefix (e.g. it is being created for the first time), no backup file is written.

BackupManager methods

BackupManager wraps the S3 client with three methods:
MethodDescription
put(filename, content)Uploads a JSON string as an S3 object with the given key
get(filename)Downloads and returns the raw bytes of an S3 object
list()Returns a list of all object keys in the configured bucket
When S3_BACKUP is not yes, all three methods are no-ops: put and get return None or an empty string, and list returns an empty list.

Browsing backups

Navigate to /backups in your browser to see a list of all backup files currently in the S3 bucket. The page is rendered server-side and shows every object key returned by BackupManager.list(). To download an individual backup file, request /backup/<name> where <name> is the object key shown on the /backups page.
GET /backups          → HTML list of all backup filenames
GET /backup/prefix_192.0.2.0_24.json  → raw JSON of that backup
If S3_BACKUP=no, the /backups page renders an empty list. No error is returned.

Restoring from backup

Download the backup file from /backup/<name> or directly from your S3 bucket, then POST it to the RIPE REST API:
curl -X POST \
  -H 'Content-Type: application/json' \
  --data @prefix.json \
  'https://rest.db.ripe.net/ripe/inetnum?password=RIPE_MNT_PASSWORD'
Replace inetnum with inet6num for IPv6 objects, and RIPE_MNT_PASSWORD with your maintainer password. The RIPE REST API will create the object if it does not exist, or return an error if a conflicting object is already present.
Without S3 backups enabled, deleted RIPE objects cannot be automatically recovered. If a prefix is removed from RIPE DB and no backup exists, you will need to reconstruct the object manually from your NetBox data and RIPE DB templates.

Build docs developers (and LLMs) love