2

How can I backup an Amazon RDS database to S3 bucket using an AWS Lambda function?

Is there is a Lambda script available?

The information in RDS should be backed-up to the S3 bucket and scheduled every hour using the Lambda function.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Mukesh
  • 33
  • 1
  • 6

4 Answers4

1

Amazon RDS has a Snapshot feature that is backs-up the data contained in the database. A Snapshot can be restored to a new Amazon RDS instance.

If you wish to trigger the Snapshot every hour, you could:

  • Create an AWS Lambda function that calls the RDS CreateSnapshot() API call
  • Configure an Amazon CloudWatch Events schedule to trigger the Lambda function at desired intervals

Alternatively, you could use AWS Backup with a cron expression to trigger an Amazon RDS backup.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
0

I know this is not a Lambda function, but perhaps look into the Database Migration Service. This allows you to migrate data from RDS to S3. It's not specifically cheap, but it is high performance and once setup can be configured to take snapshots at any interval you want.

Exelian
  • 5,749
  • 1
  • 30
  • 49
0

You could give https://github.com/intuit/Trapheus a try. This is a complete solution built using AWS Step functions and Lambdas. Could be what you are looking for

station
  • 6,715
  • 14
  • 55
  • 89
0

I would like to add here, AWS gives features directly to exports RDS snapshot to S3. It is launched in US-EAST-1 Region. enter image description here

Thanks,

Ashish

Ashish Bhatia
  • 569
  • 5
  • 14
  • 1
    And you can call this from lambda using the start_export_task function & call it from a chron scheduled cloudwatch event. You can also add a step to cleanup expired backups. – BilliD Nov 16 '20 at 17:18
  • Is this approach viable if the Database size is in GBs and have to regularly move the data, let's say everyday? – Ronnie Jun 21 '22 at 19:35