Amazon web services 更新ECS集群中fargate调度任务的任务定义
我有一个到ecs集群的管道设置,我在其中更新服务的任务定义,然后启动一个新的部署。例如:Amazon web services 更新ECS集群中fargate调度任务的任务定义,amazon-web-services,scheduled-tasks,amazon-ecs,aws-fargate,Amazon Web Services,Scheduled Tasks,Amazon Ecs,Aws Fargate,我有一个到ecs集群的管道设置,我在其中更新服务的任务定义,然后启动一个新的部署。例如: #更新任务定义 -aws ecs注册任务定义--cli输入jsonfile://aws/task-definition${TASK\u SUFFIX}.json--区域$AWS\u DEFAULT\u区域 -TASK_REVISION=`aws ecs descripe TASK definition--TASK definition${SERVICE_NAME}${TASK_SUFFIX}}| egrep
#更新任务定义
-aws ecs注册任务定义--cli输入jsonfile://aws/task-definition${TASK\u SUFFIX}.json--区域$AWS\u DEFAULT\u区域
-TASK_REVISION=`aws ecs descripe TASK definition--TASK definition${SERVICE_NAME}${TASK_SUFFIX}}| egrep“REVISION”| tr”/“| awk'{print$2}”| sed's/“$/”`
#请求服务更新:
-aws ecs更新服务--服务${service_NAME}--群集${cluster_NAME}--任务定义${service_NAME}${task_SUFFIX}:${task_REVISION}--强制新部署
我有一个使用相同服务任务定义的计划任务,两者都使用fargate。但是,当我更新服务的任务定义时,我必须手动将计划任务更新为最新版本
每当我更新服务的任务定义时,我都想将计划任务的任务定义更新为最新版本。有可能吗?所以对我来说这是可行的
aws events put-targets --cli-input-json file://.app_generic.json
app_generic.json
{
"Rule": "rule--app--generic",
"Targets": [
{
"Id": "app--generic",
"Arn": "arn:aws:ecs:us-east-1:xxxxxxx:cluster/my-cluster",
"RoleArn": "arn:aws:iam::xxxxxxx:role/ecsEventsRole",
"EcsParameters": {
"TaskDefinitionArn": "arn:aws:ecs:us-east-1:xxxxxxxx:task-definition/my-task-definitions",
"TaskCount": 1,
"LaunchType": "FARGATE",
"NetworkConfiguration": {
"awsvpcConfiguration": {
"Subnets": [
"subnet-xxxxx"
],
"SecurityGroups": [
"sg-xxxxxxx"
],
"AssignPublicIp": "ENABLED"
}
},
"PlatformVersion": "1.4.0"
}
}
]
}
基本上,我必须重新放置规则,但通过在TaskDefinitionArn中省略修订号,它将更新为最新修订版,而其他容器参数(命令、环境变量等)坚持。我想这在技术上仍然是“手动”的,但该命令可以在CI/CD、bash脚本等中的服务更新后添加。您找到解决方案了吗?我仍然愿意找到更好的解决方案,但是,这刚刚救了我的虚拟生命,谢谢!