Aws lambda 参数验证失败:\n输入中未知参数:\";包括\";,必须是以下之一:群集、服务

Aws lambda 参数验证失败:\n输入中未知参数:\";包括\";,必须是以下之一:群集、服务,aws-lambda,boto3,amazon-ecs,Aws Lambda,Boto3,Amazon Ecs,我正在编写一个lambda来根据所有ecs集群中的服务标签更新它们。为此,我需要从服务描述中提取标记,但相应的函数给出了错误 import boto3 import botocore client = boto3.client('ecs') def lambda_handler(event, context): responseToListClusters = client.list_clusters() #gets list

我正在编写一个lambda来根据所有ecs集群中的服务标签更新它们。为此,我需要从服务描述中提取标记,但相应的函数给出了错误

import boto3
import botocore

client = boto3.client('ecs')

def lambda_handler(event, context):

   responseToListClusters = client.list_clusters()                              #gets list of clusters
   clusterArnsList=responseToListClusters['clusterArns']                                   #extracts list of clusterArns
   for CLUSTER in clusterArnsList:

          responseToListServices = client.list_services(cluster= CLUSTER)                     #gets list of services
          serviceArnsList=responseToListServices['serviceArns']                                     #extracts list of serviceArns
          for SERVICE in serviceArnsList:
             responseToDescribeServices= client.describe_services(cluster=CLUSTER,services=[SERVICE,],include=['TAGS',])
             print(responseToDescribeServices)

                 #client.update_service(cluster=CLUSTER,service=SERVICE,desiredCount=1)              #updates all services

您遇到此错误是因为AWS lambda默认使用较旧版本的boto3运行

目前,AWS lamda有以下版本:

蟒蛇3.7

  • boto3-1.9.42
  • botocore-1.12.42
蟒蛇3.6

  • boto3-1.7.74
  • botocore-1.10.74
蟒蛇2.7

  • 不适用
参考:

要升级boto3版本,您可以参考以下文章:


如答案所述,boto3 1.9.42没有包含选项,请参阅。