menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Cloud News

>

Automating...
source image

Dev

2M

read

381

img
dot

Image Credit: Dev

Automating Monthly Data Deletion for Aurora MySQL with ECS, EventBridge, and DynamoDB

  • Automating Monthly Data Deletion for Aurora MySQL with ECS, EventBridge, and DynamoDB
  • Manually deleting data in Aurora MySQL is highly inefficient, so a mechanism was implemented to automate the deletion process monthly using batch processing that runs daily.
  • Initially, EventBridge and Lambda were considered for handling the batch process, but Lambda's maximum timeout wasn't sufficient, so ECS on Fargate was used instead.
  • DynamoDB was chosen to track data deleted and progress made, as it offers a free tier for storing deletion progress.
  • Steps to implement include creating a DynamoDB table, a security group for ECS, an ECR repository and ECS task definition, and an EventBridge schedule.
  • Security group rules are configured to allow the ECS task to access Aurora and DynamoDB, and MySQL connection details are retrieved from environment variables.
  • The Python script for deleting records from operations table in Aurora MySQL for each month from April 2022 to May 2024 is also shared.
  • This solution overcomes limitations of Lambda and provides scalability and efficiency in data deletion for Aurora MySQL.
  • DynamoDB's free tier allows for cost-effective progress tracking, and this solution can be adapted to various use cases of large-scale data management.
  • Data deletion success was confirmed by checking the CloudWatch logs.

Read Full Article

like

22 Likes

For uninterrupted reading, download the app