Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Terraform module for running an cron job on AWS ECS

License

Notifications You must be signed in to change notification settings

hyperscience/tf-aws-cron-job

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform: AWS Cron Job

Terraform Module that spins up a Docker-based scheduled job on AWS ECR.

Source code referenced by the blog post: https://hyperscience.com/tech-blog/running-scheduled-jobs-in-aws/

Providers

Name Version
aws n/a

Inputs

Name Description Type Default Required
cloudwatch_schedule_expression AWS cron schedule expression string n/a yes
ecr_repo_name Name of the ECR repo that contains the Docker image of your cron job string n/a yes
ecs_cluster_name (Optional) Name of the ECS Cluster that you want to execute your cron job. Defaults to your task name if no value is supplied string "" no
ecs_task_execution_role_name If the default AWS ECSTaskExecutionRole is not sufficient for your needs, you can provide your own ECS Task Execution Role here. The module will attach a CloudWatch policy for logging purposes. string "" no
extra_container_defs Additional configuration that you want to add to your task definition (see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html for all options) any {} no
image_tag Docker tag of the container that you want to run string n/a yes
subnet_ids Subnets where the job will be run list(string) n/a yes
task_cpu CPU units to allocate to your job (vCPUs * 1024) number 1024 no
task_memory In MiB number 2048 no
task_name Name of the task for resource naming string n/a yes
task_role_arn IAM role ARN for your task if it needs to access any AWS resources. IMPORTANT: This must have an AssumeRolePolicy that includes the 'ecs-tasks.amazonaws.com' provider!! any null no

Outputs

Name Description
sns_topic_arn ARN of the SNS Topic where job failure notifications are sent

About

Terraform module for running an cron job on AWS ECS

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages