awslabs / rds-snapshot-tool

The Snapshot Tool for Amazon RDS automates the task of creating manual snapshots, copying them into a different account and a different region, and deleting them after a specified number of days
Apache License 2.0
341 stars 146 forks source link

Patterns match against snapshot instead of instance #40

Closed rts-rob closed 4 years ago

rts-rob commented 5 years ago

Pattern matching in the share function matches against the DBSnapshotIdentifier instead of the DBInstanceIdentifier. This results in orphaned snapshots which are not shared, and therefore not copied to the destination account.

An example:

The pattern .+(-production)$ matches all instances that end in -production. Given an RDS instance django-production and an RDS instance django-production-reporting, we want to copy the first but not the second.

The pattern matches correctly when taking snapshots, but appends YYYY-MM-DD-hh-mm to the DBSnapshotIdentifier. When the share function executes, the DBSnapshotIdentifier does not match the pattern, so the snapshot is not shared.