-
Notifications
You must be signed in to change notification settings - Fork 424
task run command
David Killmon edited this page Aug 14, 2020
·
7 revisions
$ copilot task run
Task run deploys and runs one-off tasks.
Generally, the steps involved in task run are:
- Create an ECR repository and a log group for your task
- Build and push the image to ECR
- Create or update your ECS task defitinion
- Run and wait for the tasks to start
- Tasks with the same group name share the same set of resources, including CloudFormation stack, ECR repository, CloudWatch log group and task definition.
- If the tasks are deployed to a Copilot environment (i.e. by specifying
--env
), only public subnets that are created by that environment will be used. - 🚨 the
--env
flag only works with environments created with v0.3.0 of Copilot or later. Customers using environments created with v0.2.0 or earlier can update their environment manager role with this policy.
--app string Optional. Name of the application.
Cannot be specified with 'default', 'subnets' or 'security-groups'
--command string Optional. The command that is passed to "docker run" to override the default command.
--count int Optional. The number of tasks to set up. (default 1)
--cpu int Optional. The number of CPU units to reserve for each task. (default 256)
--default Optional. Run tasks in default cluster and default subnets.
Cannot be specified with 'app', 'env' or 'subnets'.
--dockerfile string Path to the Dockerfile. (default "Dockerfile")
--env string Optional. Name of the environment.
Cannot be specified with 'default', 'subnets' or 'security-groups'
--env-vars stringToString Optional. Environment variables specified by key=value separated with commas. (default [])
--execution-role string Optional. The role that grants the container agent permission to make AWS API calls.
--follow Optional. Specifies if the logs should be streamed.
-h, --help help for run
--image string Optional. The image to run instead of building a Dockerfile.
--memory int Optional. The amount of memory to reserve in MiB for each task. (default 512)
--resource-tags stringToString Optional. Labels with a key and value separated with commas.
Allows you to categorize resources. (default [])
--security-groups strings Optional. The security group IDs for the task to use. Can be specified multiple times.
Cannot be specified with 'app' or 'env'.
--subnets strings Optional. The subnet IDs for the task to use. Can be specified multiple times.
Cannot be specified with 'app', 'env' or 'default'.
--tag string Optional. The container image tag in addition to "latest".
-n, --task-group-name string Optional. The group name of the task. Tasks with the same group name share the same set of resources.
--task-role string Optional. The role for the task to use.
You will be prompted to specify a task group name and an environment for the tasks to run in.
$ copilot task run
$ copilot task run -n db-migrate --env test
$ copilot task run --num 4 --memory 2048 --image=rds-migrate --task-role migrate-role
$ copilot task run --env-vars name=myName,user=myUser
$ copilot task run --subnets subnet-123,subnet-456 --security-groups sg-123,sg-456
$ copilot task run --command "python migrate-script.py"