Scheduled Job
List of all available properties for a 'Scheduled Job'
manifest.
# Your job name will be used in naming your resources like log groups, ECS Tasks, etc.
name: report-generator
# The type of job that you're running.
type: Scheduled Job
image:
# Path to your service's Dockerfile.
build: ./Dockerfile
# Or instead of building, you can specify an existing image name.
location: aws_account_id.dkr.ecr.region.amazonaws.com/my-svc:tag
on:
# The scheduled trigger for your job. You can specify a Unix cron schedule or keyword (@weekly) or a rate (@every 1h30m)
# AWS Schedule Expressions are also accepted: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
schedule: @daily
cpu: 256 # Number of CPU units for the task.
memory: 512 # Amount of memory in MiB used by the task.
retries: 3 # Optional. The number of times to retry the job before failing.
timeout: 1h # Optional. The timeout after which to stop the job if it's still running. You can use the units (h, m, s).
variables: # Optional. Pass environment variables as key value pairs.
LOG_LEVEL: info
secrets: # Optional. Pass secrets from AWS Systems Manager (SSM) Parameter Store.
GITHUB_TOKEN: GITHUB_TOKEN # The key is the name of the environment variable, the value is the name of the SSM parameter.
environments: # Optional. You can override any of the values defined above by environment.
prod:
cpu: 512
name
String
The name of your job.
type
String
The architecture type for your job.
Currently, Copilot only supports the "Scheduled Job" type for tasks that are triggered either on a fixed schedule or periodically.
image
Map
The image section contains parameters relating to the Docker build configuration.
image.build
String or Map
If you specify a string, Copilot interprets it as the path to your Dockerfile. It will assume that the dirname of the string you specify should be the build context. The manifest:
image:
build: path/to/dockerfile
$ docker build --file path/to/dockerfile path/to
You can also specify build as a map:
image:
build:
dockerfile: path/to/dockerfile
context: context/dir
target: build-stage
cache_from:
- image:tag
args:
key: value
$ docker build --file path/to/dockerfile --target build-stage --cache-from image:tag --build-arg key=value context/dir
.
You can omit fields and Copilot will do its best to understand what you mean. For example, if you specify context
but not dockerfile
, Copilot will run Docker in the context directory and assume that your Dockerfile is named "Dockerfile." If you specify dockerfile
but no context
, Copilot assumes you want to run Docker in the directory that contains dockerfile
.
All paths are relative to your workspace root.
image.location
String
Instead of building a container from a Dockerfile, you can specify an existing image name. Mutually exclusive with image.build
.
The location
field follows the same definition as the image
parameter in the Amazon ECS task definition.
on
Map
The configuration for the event that triggers your job.
on.schedule
String
You can specify a rate to periodically trigger your job. Supported rates:
"@yearly"
"@monthly"
"@weekly"
"@daily"
"@hourly"
"@every {duration}"
(For example, "1m", "5m")"rate({duration})"
based on CloudWatch's rate expressions
Alternatively, you can specify a cron schedule if you'd like to trigger the job at a specific time:
"* * * * *"
based on the standard cron format."cron({fields})"
based on CloudWatch's cron expressions with six fields.
cpu
Integer
Number of CPU units for the task. See the Amazon ECS docs for valid CPU values.
memory
Integer
Amount of memory in MiB used by the task. See the Amazon ECS docs for valid memory values.
retries
Integer
The number of times to retry the job before failing.
timeout
Duration
How long the job should run before it aborts and fails. You can use the units: h
, m
, or s
.
variables
Map
Key-value pairs that represent environment variables that will be passed to your job. Copilot will include a number of environment variables by default for you.
secrets
Map
Key-value pairs that represent secret values from AWS Systems Manager Parameter Store that will be securely passed to your job as environment variables.
environments
Map
The environment section lets you override any value in your manifest based on the environment you're in.
In the example manifest above, we're overriding the CPU parameter so that our production container is more performant.