ecs-cli compose start
Starts a single Amazon ECS task from the task definition created from your Compose file.
Some features described might only be available with the latest version of the Amazon ECS CLI. For more information about obtaining the latest version, see Installing the Amazon ECS CLI.
Syntax
ecs-cli compose start [--region region
]
[--cluster-config cluster_config_name
] [--ecs-profile
ecs_profile
] [--aws-profile
aws_profile
] [--cluster
cluster_name
] [--launch-type
launch_type
] [--create-log-groups]
[--help]
Options
Name |
Description |
---|---|
|
Specifies the AWS Region to use. Defaults to the cluster configured using the configure command. Type: String Required: No |
|
Specifies the name of the Amazon ECS cluster configuration to use. Defaults to the cluster configuration set as the default. Type: String Required: No |
|
Specifies the name of the Amazon ECS profile configuration to use. Defaults to the profile configured using the configure profile command. Type: String Required: No |
|
Specifies the AWS profile to use. Enables you to use the AWS credentials from an existing named profile in Type: String Required: No |
|
Specifies the Amazon ECS cluster name to use. Defaults to the cluster configured using the configure command. Type: String Required: No |
|
Specifies the launch type to use. Available options are
This overrides the default launch type stored in your cluster configuration. Type: String Required: No |
|
Creates the CloudWatch log groups specified in your Compose files. Required: No |
|
Shows the help text for the specified command. Required: No |
Examples
Run a Task
This example creates a task definition from the
hello-world.yml
Compose file. Additional ECS parameters
are specified for task networking configuration for the Fargate
launch type. Then a single task is run using that task definition.
Example Docker Compose file, named hello-world.yml
:
version: '3' services: nginx: image: nginx:latest ports: - "80:80" logging: driver: awslogs options: awslogs-group:
tutorial
awslogs-region:us-east-1
awslogs-stream-prefix:nginx
Example ECS parameters file, named ecs-params.yml
:
version: 1 task_definition: task_execution_role:
ecsTaskExecutionRole
ecs_network_mode: awsvpc task_size: mem_limit:0.5GB
cpu_limit:256
run_params: network_configuration: awsvpc_configuration: subnets: -subnet-abcd1234
-subnet-dbca4321
security_groups: -sg-abcd1234
assign_public_ip: ENABLED
Command:
ecs-cli compose --file
hello-world.yml
--ecs-paramsecs-params.yml
start --launch-typeFARGATE
--create-log-groups
Output:
INFO[0000] Using ECS task definition TaskDefinition=ecscompose-hello-world:5