Answers: <p>AWS Lambda should be an obvious choice together with a a CloudWatch Event trigger <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html</a> .</p>
  <p>Running an EC2 instance may be reasonable in some scenarios as well. It would make sense for me if the trigger for example did some complex data manipulation on a reasonable small data set (fitting in memory on a bigger spot multi-core instance or something like that).</p>
  <p>Running a Fargate task - may be reasonable as well.</p>
  <p>If it is something close to the gcloud example I would go with Lambda + CloudWatch Event. All of this can be easily defined via CloudFormation template .</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-12-16T18:16:27.313Z
Answers: GCP's answer to Lambda is Cloud Functions. You find find them in the console under "Serverless"
Answers: code_monk
Answers: CC BY-SA 4.0
Answers: 2021-12-19T19:25:07.337Z
Answers: you can utilize, kubernetes `jobs` as well.
Answers: AATHITH RAJENDRAN
Answers: CC BY-SA 4.0
Answers: 2021-12-12T22:22:05.930Z
Answers: 2021-12-12T22:22:05.930Z
Answers: petrchpetr
Body: <p>I have a small python piece of code that I want to run on a schedule. The dirty way to do it would be to just spin up an EC2 instance and use CRON to run the script.</p>
  <p>But I was wondering if there's a better (cleaner) way to do this</p>
  <p>Also I was wondering how to do the same but on Google Cloud as well as AWS</p>
  
Comments: CC BY-SA 4.0
Comments: 2021-12-12T13:31:40.803Z
Comments: Update: I found this Google Cloud article that has a good explanation. https://cloud.google.com/blog/products/application-development/how-to-schedule-a-recurring-python-script-on-gcp
Comments: Aayush Agrawal
Tags: <amazon-web-services><gcp>
Title: How do I setup a script to run on a schedule in a clean & professional way?
UserDisplayName: Aayush Agrawal
ThreadText: # How do I setup a script to run on a schedule in a clean & professional way?
  
  (Asked by: username_0 on 2021-12-12)
  
  I have a small python piece of code that I want to run on a schedule. The dirty way to do it would be to just spin up an EC2 instance and use CRON to run the script.
  
  But I was wondering if there's a better (cleaner) way to do this
  
  Also I was wondering how to do the same but on Google Cloud as well as AWS
  
  **Tags:** amazon-web-services, gcp
  
  > **Comments:**
  > **username_0**: Update: I found this Google Cloud article that has a good explanation. https://cloud.google.com/blog/products/application-development/how-to-schedule-a-recurring-python-script-on-gcp  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-12-12. Score: 3 | Accepted answer
  
  AWS Lambda should be an obvious choice together with a a CloudWatch Event trigger <https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html> .
  
  Running an EC2 instance may be reasonable in some scenarios as well. It would make sense for me if the trigger for example did some complex data manipulation on a reasonable small data set (fitting in memory on a bigger spot multi-core instance or something like that).
  
  Running a Fargate task - may be reasonable as well.
  
  If it is something close to the gcloud example I would go with Lambda + CloudWatch Event. All of this can be easily defined via CloudFormation template .
  
  > **Comments:**
  > **username_2**: GCP's answer to Lambda is Cloud Functions. You find find them in the console under "Serverless"  
  > **username_3**: you can utilize, kubernetes `jobs` as well.  
  
  ---
  
  