en Lopes
en Lopes

Reputation: 2133

Stopping an Amazon RDS DB Instance Temporarily

Is there a way to create a cron job in AWS that automatically starts / stops the DB everyday ?

Upvotes: 2

Views: 1074

Answers (1)

Ashan
Ashan

Reputation: 19738

You can use AWS Lambda Scheduled Events to start and stop the RDS Server writing code using AWS SDK for RDS. You can use startDBInstance and stopDBInstance methods. Following example shows how to stop the DB instance using AWS SDK for NodeJS.

var params = {
  DBInstanceIdentifier: 'STRING_VALUE', /* required */
  DBSnapshotIdentifier: 'STRING_VALUE'
};
rds.stopDBInstance(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Upvotes: 1

Related Questions