【发布时间】:2021-01-22 13:38:30
【问题描述】:
在通过 cloudformation 创建 AWS::ECS::Service 期间出现错误:Model validation failed
错误与#HealthCheckGracePeriodSeconds 和其他一些属性有关。错误详情为:expected type: Number, found: String。
在 yaml 中它已经是一个数字。我不清楚出了什么问题。已经尝试将其声明为字符串或 Number 类型的参数。
我需要一些提示,因为此时我陷入了困境。
错误是:
Model validation failed
(
#/HealthCheckGracePeriodSeconds: expected type: Number, found: String
#/DesiredCount: expected type: Number, found: String
#/DeploymentConfiguration/MaximumPercent: expected type: Number, found: String
#/DeploymentConfiguration/MinimumHealthyPercent: expected type: Number, found: String
)
template.yaml 中的定义是:
ServiceDefinition:
Type: AWS::ECS::Service
Properties:
ServiceName: !Ref ServiceName
Cluster: !Ref ClusterName
TaskDefinition: !Ref TaskDefinition
DeploymentConfiguration:
MinimumHealthyPercent: 100
MaximumPercent: 200
DesiredCount: 1
HealthCheckGracePeriodSeconds: 60
LaunchType: FARGATE
NetworkConfiguration:
AwsVpcConfiguration:
AssignPublicIP: ENABLED
SecurityGroups: !FindInMap [Env2SecurityGroups, !Ref AWS::AccountId, securitygroup]
Subnets: !FindInMap [Env2PublicSubnets, !Ref AWS::AccountId, subnets]
【问题讨论】:
-
这看起来不错。您确定这是给出错误的资源吗?
标签: amazon-cloudformation amazon-ecs