<p><strong>CloudFormation</strong> is service that allows you to create your infrastructure from code to automate your deployments.</p>

<p>You can set up a rule to run an AWS Lambda function on a schedule by using <strong>CloudWatch event</strong>. 
<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>

CC BY-SA 4.0
2018-11-21T11:16:18.137Z
2018-11-21T11:16:18.137Z
Evgeny Anikiev
<p>CloudFormation by itself has no way to schedule execution every minute. CloudFormation is great to create AWS resources, like Lambda, but not execute them.</p>

<p>There is another facility in AWS that allows scheduling execution of Lambda functions, it is called “CloudWatch Events”. You can set it to run the Lambda every minute, and you can create the rule for CWE using CloudFormation.</p>

<p>Ansible is similar to CloudFormation in this regard, it can create resources - but has no mechanism to do scheduled executions, only setup some other resource to execute on a schedule.</p>

CC BY-SA 4.0
2018-10-21T06:10:22.207Z
2018-10-21T06:10:22.207Z
Evgeny Zislis
<p>I have deployed an AWS Lambda with Python 3.6 and CloudFormation executing a scheduled task which writes a JSON file once a minute to an S3 bucket. Now I wonder if this is a good way of doing it, or if an automation tool such as Ansible would be better suited for the task?</p>

<p>The background is that I am developing a PoC for data analysis. </p>

<ansible><aws-lambda>
Choice for scheduled task in AWS
Niklas Rosencrantz
# Choice for scheduled task in AWS

(Asked by: username_0 on 2018-10-21)

I have deployed an AWS Lambda with Python 3.6 and CloudFormation executing a scheduled task which writes a JSON file once a minute to an S3 bucket. Now I wonder if this is a good way of doing it, or if an automation tool such as Ansible would be better suited for the task?

The background is that I am developing a PoC for data analysis.

**Tags:** ansible, aws-lambda


---

## 2 answers

### Answer by username_1 on 2018-11-21. Score: 1

**CloudFormation** is service that allows you to create your infrastructure from code to automate your deployments.

You can set up a rule to run an AWS Lambda function on a schedule by using **CloudWatch event**.
<https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html>


---

### Answer by username_2 on 2018-10-21. Score: 0

CloudFormation by itself has no way to schedule execution every minute. CloudFormation is great to create AWS resources, like Lambda, but not execute them.

There is another facility in AWS that allows scheduling execution of Lambda functions, it is called “CloudWatch Events”. You can set it to run the Lambda every minute, and you can create the rule for CWE using CloudFormation.

Ansible is similar to CloudFormation in this regard, it can create resources - but has no mechanism to do scheduled executions, only setup some other resource to execute on a schedule.


---

