How to backup Amazon RDS database to S3 bucket using Lambda function

Viewed 4550

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.

4 Answers

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.

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.

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

Related