简体   繁体   中英

Is it possible to run AWS ECS scheduled task manually?

I have daily cron task in the ECS. Sometimes, I need to run it one-off manually. Is it possible?

Yes, you can use the CLI to do this. For an ECS Fargate task, it looks like this:

> aws --profile YOUR_IAM_PROFILE ecs run-task --task-definition TASK_DEFINITION --cluster ECS_CLUSTER --network-configuration '{"awsvpcConfiguration":{"subnets":["subnet-SUBNET_ID"],"securityGroups":["sg-SECURITY_GROUP_ID"],"assignPublicIp":"ENABLED"}}' --launch-type FARGATE --propagate-tags TASK_DEFINITION --overrides '{"containerOverrides":[{"name":"YOUR_CONTAINER","command":["YOUR", "CMD", "OVERRIDE", "HERE"]}]}'

You can learn more about the CLI skeleton from here and see the JSON values available for "run-task" using

> aws ecs run-task --generate-cli-skeleton

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM