【问题标题】:How to update a ecs service using nodejs API?如何使用 nodejs API 更新 ecs 服务?
【发布时间】:2019-12-31 11:39:28
【问题描述】:

我想使用 nodejs 更新 ECS 服务 API 的所需、最小和最大计数(而不是如下所述的 python,来源:aws 示例)

import boto3
def handler(event, context):
    ecsregion = event['region']
    cluster_name = event['cluster']
    service_name = event['service']
    task_count = event['taskCount']
    ecs_client = boto3.client('ecs', region_name=ecsregion)
    response=ecs_client.update_service(cluster=cluster_name, service=service_name, desiredCount=int(task_count))
    print(response)

【问题讨论】:

    标签: node.js amazon-web-services amazon-ecs


    【解决方案1】:

    没关系,我从 AWS Source 中找到了部分答案。让我使用它,如果我再次卡住会回来。

    /* This example updates the desired count of the my-http-service service to 10. */
    
     var params = {
      desiredCount: 10, 
      service: "my-http-service"
     };
     ecs.updateService(params, function(err, data) {
       if (err) console.log(err, err.stack); // an error occurred
       else     console.log(data);           // successful response
       /*
       data = {
       }
       */
     });
    

    【讨论】:

      猜你喜欢
      • 2018-05-16
      • 2021-03-29
      • 2021-10-06
      • 2023-02-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-12
      • 1970-01-01
      • 2020-01-03
      相关资源
      最近更新 更多