Amazon EventBridge Cron to Amazon ECS Task

Amazon EventBridge → Amazon ECS

Use Amazon EventBridge to schedule and trigger ECS Fargate tasks on a cron schedule, deployed with Terraform as IaC.

This pattern creates an automated scheduled task execution system using EventBridge cron rules with ECS Fargate tasks.
The EventBridge rule triggers on a configurable schedule (cron or rate expression) and launches an ECS task in the specified cluster.
The solution is fully configurable through Terraform variables and implements security best practices with least-privilege IAM roles.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-scheduler-ecs-python-terraform

Deploy

terraform initterraform planterraform apply


Testing

Check the EventBridge rule in the AWS Console to verify it's created with the correct schedule.
Manually trigger the rule to test the ECS task execution.
View CloudWatch logs to confirm the task is running as expected.

Cleanup

terraform destroy
Confirm the destruction by typing 'yes' when prompted.

Created by:

Sudhansu Mohapatra

Sudhansu Mohapatra

Delivery Consultant at AWS

Follow on LinkedIn