Created
December 13, 2025 12:14
-
-
Save gchait/3884f838c500f8c2f7963ea93405fdd2 to your computer and use it in GitHub Desktop.
Treat an ECS task as a job
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # shellcheck disable=SC2086 | |
| set -o allexport | |
| source .env | |
| set +o allexport | |
| cluster_args="--cluster ${ECS_CLUSTER} --region ${REGION}" | |
| net_config="{\"awsvpcConfiguration\":{\"assignPublicIp\":\"XXX\",\"subnets\":[\"${SUBNET_ID}\"]}}" | |
| task_arn=$(aws ecs run-task ${cluster_args} \ | |
| --task-definition "${ECS_TASK_DEF_ARN}" --launch-type FARGATE \ | |
| --network-configuration "${net_config}" \ | |
| --query 'tasks[].taskArn') | |
| aws ecs wait tasks-running ${cluster_args} --tasks "${task_arn}" | |
| aws ecs wait tasks-stopped ${cluster_args} --tasks "${task_arn}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment