【问题标题】:Getting "cli-input-json' : invalid json received"获取“cli-input-json”:收到无效的 json”
【发布时间】:2020-09-14 05:49:18
【问题描述】:

我正在尝试在 AWS ECS 中使用 Fargate 启动类型运行服务。以下是我的 service-definition.json 文件。

{
  "serviceName": "MyService",
  "cluster": "arn of my cluster",
  "launchType": "FARGATE",
  "deploymentConfiguration": {
    "maximumPercent": 200,
    "minimumHealthyPercent": 0
  },
  "desiredCount": 1,
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "DISABLED",
      "securityGroups": [
        "sec-group-id"
      ],
      "subnets": [
        "subnet-1",
        "subnet-2"
      ]
    }
  },
  "taskDefinition": "mytask",
  "loadBalancers": [
    {
      "containerName": "mytask-container",
      "containerPort": 8080,
      "targetGroupArn": "arn to my target group"
    }
  ]
}

在运行此命令时: aws ecs create-service --cli-input-json service-definition.json。我收到无效的 json 错误。

我已经验证了我的 json 语法。我只是想确认这个定义在逻辑上是否可行?如果不是,欢迎指正。

【问题讨论】:

    标签: json amazon-web-services amazon-ecs amazon-vpc aws-fargate


    【解决方案1】:

    当你想使用一个文件时,你必须为cli-input-json使用以下格式(file://):

    aws ecs create-service --cli-input-json file://service-definition.json
    

    示例在 create-service 文档中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 2017-01-22
      • 2020-12-01
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      相关资源
      最近更新 更多