Search code examples
amazon-web-servicesamazon-rdsamazon-ecs

Scheduling RDS only to run when a scheduled Fargate task is running


I have a Fargate task that runs regularly once a day. Other than that, there is no need for the database to be up and running. Any way to make it so that the Fargate task triggers the start and stop of the RDS database instance?


Solution

  • One of the option could be to switch to Serverless DB i.e. AWS Aurora serverless

    Amazon Aurora Serverless is an on-demand, auto-scaling configuration for Amazon Aurora (MySQL-compatible and PostgreSQL-compatible editions), where the database will automatically start up, shut down, and scale capacity up or down based on your application's needs. It enables you to run your database in the cloud without managing any database instances. It's a simple, cost-effective option for infrequent, intermittent, or unpredictable workloads.

    Another option to setup a lambda that you can trigger when you need it. This blog provides all the details for that

    https://dzone.com/articles/create-an-aws-lambda-function-to-stop-and-start-an