Reputation: 59
I want my application to be able to run automatically, every hour of every day. The NodeJS script produces a JSON file, which needs to be uploaded to an EC2 instance. As the question notes, I am planning on making this happen using Lambda, and cron
jobs. I know how to schedule it, but I don't know if
a. I can create a file using Lambda functions
b. Even if I can, will I be able to move the file from Lambda to my instance?
Do I need to use S3 buckets?
Upvotes: 0
Views: 107
Reputation: 59
So the problem I was having was that, my node application would stop running if I exited the terminal (via Putty). So, now I'm going to use nohup
and node-schedule
.
Upvotes: 0
Reputation: 238199
There are few possibilities of doing this. I will list one which, in my view, is most scalable (can work with multiple instance) and manageable.
The use case could work in the following way:
Schedule your lambda function to be triggered automatically using CloudWatch Events and cron expressions.
Have the lambda function create the required file and upload it to S3.
Use the same lambda to trigger SSM Run Command which is going to run a code on your instance(s). The code will download the file from S3.
Can also setup notification for the SSM Run Command, to be notified when it finishes successfully or fail, using CloudWatch Events.
Upvotes: 1