diff --git a/README.md b/README.md index e524c7c..1f184e1 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,13 @@ DB_PASSWORD= DB_NAME= ``` +If the service type is **Fargate**, and you're using the `run-task.sh` script, please include: +```bash +SERVICE_TYPE=FARGATE +SUBNETS=subnet1231231,subnet123123123,subnter123123123123 +``` +Default values are: null + `task-definition.tpl.json` (example) ```json { diff --git a/src/run-task.sh b/src/run-task.sh index a56cfa7..eb1ae78 100755 --- a/src/run-task.sh +++ b/src/run-task.sh @@ -31,11 +31,23 @@ echo " CLUSTER_NAME: ${CLUSTER_NAME}" echo " APP_NAME: ${APP_NAME}" echo " TASK_DEFINITION_ARN: ${TASK_ARN}" echo -n " STATUS: " + +# Check if cluster type is fargate +if [[ "$SERVICE_TYPE" == "FARGATE" ]]; then +TASK_ID=$(aws ecs run-task \ + --cluster $CLUSTER_NAME \ + --task-definition $TASK_ARN \ + --network-configuration "awsvpcConfiguration={subnets=[${SUBNETS}]}" \ + --launch-type FARGATE \ + --query="tasks[0].taskArn" \ + --output=text) +else TASK_ID=$(aws ecs run-task \ --cluster $CLUSTER_NAME \ --task-definition $TASK_ARN \ --query="tasks[0].taskArn" \ --output=text) + fi sleep 5