gpt4 book ai didi

amazon-web-services - 发现 CloudFormation ECS ContainerDefinitions 预期类型 : JSONArray,:字符串

转载 作者:行者123 更新时间:2023-12-03 07:30:30 26 4
gpt4 key购买 nike

我尝试部署 CloudFormation 模板并收到以下错误:

(这是一个 YAML 文件)

资源处理程序返回消息:“模型验证失败(#/ContainerDefinitions:预期类型:JSONArray,找到:String)”(RequestToken:d23861e3-70c3-2777-96ce-18b46a118437,HandlerErrorCode:InvalidRequest)

我必须从下面的代码中删除一些值,但除此之外它的布局相同。

ECSTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions: !Sub |
[
{
"name": "web",
"image": "xxxxxxxxxxxxxxxxxxxxx:latest",
"portMappings": [
{
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp"
}
],
"environment": [
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
},
{
"name": "",
"value": ""
}
],
"ulimits": [
{
"name": "nofile",
"softLimit": 65536,
"hardLimit": 65536
}
],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"secretOptions": null,
"options": {
"awslogs-group": "/ecs/web",
"awslogs-region": "eu-west-2",
"awslogs-stream-prefix": "ecs"
}
}
}
]

最佳答案

容器定义中的管道将在 yaml 中强制使用字符串。这就是问题所在。

容器定义:!Sub |

遵循文档https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html

关于amazon-web-services - 发现 CloudFormation ECS ContainerDefinitions 预期类型 : JSONArray,:字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72044464/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com