Why don’t you do the csv load with the lambda instead? Is it going to take longer than 15 minutes?
Edit:
With the aws Database Migration Service you could detect changes in an S3 with the CDC and replicate them to RDS. However I dont know if this is going to be cheaper than the lambda.
I work on a product that does large loads of data into our Aurora database and we use a similar method to the above with a Lambda. We massage data with the Lambda before importing.
Can each line in the csv be loaded independently? If so you could split the load up into smaller chunks and process each chunk in a lambda, eg using step functions or just pushing chunks onto an sqs queue.
If you want to stay more with ec2, I would build a container and use fargate to run the container on demand.
You could start a Fargate task instead of spinning up an EC2? It would be simpler to trigger than spinning up an EC2, you’d still need the lambda though.
Do you need the csv to be loaded into rds immediately after S3 object creation? Otherwise you could just send the events to sqs and once per day empty that queue with one or two scheduled ec2 instances.
You should consider AWS batch instead of the EC2 approach. You might be able to trigger the job directly from EventBridge, but a small Lambda might be needed to set up the right params.
Yeah I think ideally the data could get into SQS so SQS can trigger a lambda to ingest data in more reasonable blocks. But I guess the problem would be getting the stuff into SQS if OP is restricted to ingesting via a fat ass CSV
You can setup a CloudFormation template that runs when the lambda is triggered and self-terminate after the data is added.
You might also setup an ECS Cluster/Sevice. Just set the desired count to 1 when you need to process data, then set back to zero when the data is handled. The infrastructure will take care of tearing down tasks and instances.
Update: Fargate might be a better alternative using ECS. Avoids the need to handle EC2.
Look at using Fargate tasks instead of spinning up EC2. I gave a talk about using this approach for exporting RDS MySQL databases, you can use the same approach for loading data to Postgres
Batch and Fargate are similar items, in fact Fargate can be run in Batch or ECS. Ideally, I would use Fargate for event based triggers that could happen at any moment and Batch for cron based items that occur at set intervals. Cool, thing about Batch is you can run it on an EC2 and only get charged for however long it runs, so you could have a beefier EC2 and use spot pricing to to lower your costs.