Fargate
Listing components
# List clusters
aws ecs list-clusters
# List task definitions
aws ecs list-task-definitions
# List tasks in a given cluster.
aws ecs list-tasks --cluster $cluster_id
Tasks
# Create task.
aws ecs run-task --cluster $cluster_id --task-definition $task_def_name:$version --enable-execute-command --count 1 --launch-type FARGATE --network-configuration "awsvpcConfiguration={subnets=[subnet-1234],securityGroups=[sg-1234],assignPublicIp=ENABLED}"
# Run exec command.
aws ecs execute-command --cluster $cluster_id --task $task_id --interactive --command "/bin/bash"
# Stop task
aws ecs stop-task --cluster $cluster_id --task $task_id
Services
# Create service.
aws ecs create-service --cluster $cluster_id --task-definition $task_def_name:$version --enable-execute-command --service-name $srv_name --desired-count 1