Yesterdaytabase is a Lambda function that pulls previous snapshots of RDS databases for use as staging or testing environments. The function runs on a schedule and recreates the DB with a CloudFormation stack. For more about the internals, see my blog post on it.
If you only have one database, launch the stack and fill in the
SourceConfiguration
value with a one-line JSON object. The config is in this
format:
{
"config": {
"domain": "mysite.com", # the root of your Route53 zone
"db": {
"name": "my-rds-dbname",
"security_group": "sg-12345678",
"subnet_group": "net-group-12345678" # the RDS subnet group to launch the DB in
}
}
}
For more databases, create more CloudWatch Event rules that have the same JSON format in their input field.
Alternatively, you can bake the configuration into a file in the deployed
function, called config.json
. The format matches the config
key in the
event above.
Want to run it? Launch it and go. Fill in the database you've got snapshots of and your Route53 domain.