-2

I've created a python script that grabs information from an API and sends it in an email. I'd like to automate this process so to run on daily basis let's say at 9AM.

The servers must be asleep when they will not be running this automation.

What is the easiest way to achieve this?

Note: Free version of AWS.

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
digoprt
  • 11
  • 2
  • Are you asking specifically how to do this on Cloud9 or how to accomplish this in general on a Unix/Linux system? – mistertee Apr 22 '21 at 13:54

2 Answers2

0

cloud9 is the ide that lets you write, run, and debug your code with just a browser. "It preconfigures the development environment with all the SDKs, libraries, and plug-ins needed for serverless development. Cloud9 also provides an environment for locally testing and debugging AWS Lambda functions. This allows you to iterate on your code directly, saving you time and improving the quality of your code."

okay for the requirement you have posted :-

there are 2 ways of achieving this

  1. on a local system use cron job scheduler daemon to run the script. a tutorial for cron.tutorial for cron

  2. same thing can also be achieved by using a lambda function. lambda only runs when it is triggered, using compute resources for that particular time when it is invoked so your servers are sleeping for the rest of time( technically you are not provisioning any server for lambda)

  3. convert your script in a function for lambda. and then use event bridge service where you can specify a corn expression to run your script everyday at 9am. wrote an article on the same may it can help.

note :- for email service you can use ses https://aws.amazon.com/ses/. my article uses ses.

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
0

To schedule Events you'd need a Lambda function with Cloudwatch events such as follow. https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html

Cloud9 is an IDE.

  • Lambda is fine for tasks that run for less than 15mins, but there are many tasks that run for longer, and for this you have to use EC2. Yes Cloud 9 is an IDE, but its sitting on top of an EC2 instance. Cloud 9 is a convenient interface for EC2. I think the question is, is it possible to setup a cron using Cloud 9. – MrJedi2U Jun 13 '23 at 13:19