Stopping an Amazon RDS DB Instance Temporarily

▼魔方 西西 提交于 2021-01-28 09:41:48

问题


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


回答1:


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
});


来源:https://stackoverflow.com/questions/46450108/stopping-an-amazon-rds-db-instance-temporarily

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!