Reputation: 199
I'm working on a JAVA project which uploads files to AWS S3 bucket. Now I need to process those files in S3 (validate and send data to database) everyday at 8.00 a.m. I'm planning to use AWS scheduler for this. But I'm confuse what's the scheduler I have to use and how to use. I went through documentation and found about AWS Batch and AWS cloud watch scheduler through Lambda. But I have no idea about what's the best way to use AWS scheduler in this scenario. Not sure weather AWS Batch works for this. Actually I need to consider the cost as well. I'm glad if you could suggest me the best way to resolve this. Alternative methods are also welcome.
P.S: File process will take more than 15 mins. And also I need to config several other schedulers as well.
Upvotes: 0
Views: 902
Reputation: 2658
My proposed solution here is
Note: The design here is to take cost, scaling, maintenance and design (loose-coupling) as priority.
Note: The assumption from here is processing a file (single files) doesn't take more than 15 minutes as limit of lambda. If a processing time of a file takes more than 15 minutes, the above solution won't work. I can give another solution if you confirm.
Upvotes: 3
Reputation: 3102
One way (there are always many with AWS) is through EventBridge formerly CloudWatch Events and AWS Lambda. I haven't worked with AWS Batch before.
Code and deploy your AWS Lambda function. In your Lambda you access the S3 bucket, validate, and send the data to the database.
If you open the AWS Console, go to your Lambda function. Next add Trigger and select EventBridge.
Now you can create a new rule. To make it run everday at 8am your Schedule Expression is cron(0 8 * * ? *)
Some things to keep in mind:
Upvotes: 1