Schedule Jobs with AWS Fargate

Amazon EventBridge → AWS Fargate

Create a scheduled AWS Fargate Task running on AWS ECS Cluster and EventBridge Rule using Serverless Framework

This pattern deploys an AWS Fargate Task on AWS ECS Cluster which runs on EventBridge Rule.
The Docker image for the task based on Node.js is built first, then the image is pushed to AWS ECR. AWS ECS pulls the image from ECR and runs the image on Fargate. A serverless plugin called 'serverless-fargate' is used to create the template. The job is scheduled to run on every 10 minutes.
A simple JSON file containing message string and timestamp, is pushed to S3 bucket. All the necessary resources and permissions are configured using Serverless Framework.

< 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/fargate-eventbridge-serverless

Deploy

serverless deploy --verbose


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

serverless remove --verbose.

Created by:

Tejas Dhamecha

Tejas Dhamecha is a Software Engineer working at Distinction-Dev, India who has a passion for building serverless solutions.

Follow on LinkedIn