gpt4 book ai didi

json - Cloudformation 错误(属性 Step adjustment 的值必须是对象列表)

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

当我尝试启动堆栈时,我不断收到此资源创建错误

    ServiceScalingPolicyIn:
Properties:
PolicyName: StepDown
PolicyType: StepScaling
ScalingTargetId:
Ref: ServiceScalingTarget
StepScalingPolicyConfiguration:
AdjustmentType: ChangeInCapacity
Cooldown: '300'
MetricAggregationType: Average
StepAdjustments:
- - MetricIntervalLowerBound: '0'
ScalingAdjustment:
Ref: TasksCount
Type: AWS::ApplicationAutoScaling::ScalingPolicy

CPUAlarmScalein:
Properties:
EvaluationPeriods: '1'
Statistic: Average
Threshold: '25'
AlarmDescription: Alarm if CPU usage is lower, this will always be
Period: '300'
AlarmActions:
- Ref: ServiceScalingPolicyIn
Namespace: AWS/ECS
Dimensions:
- Name: ClusterName
Value: ECS365-sandbox
- Name: ServiceName
Value: ECSService365
ComparisonOperator: LessThanThreshold
MetricName: CPUUtilization
Type: AWS::CloudWatch::Alarm

我尝试调整更改

ServiceScalingTarget:
DependsOn: ECSService365
Properties:
MaxCapacity: '10'
MinCapacity: '1'
ResourceId:
Fn::Join:
- ''
- - service/
- Ref: Cluster365
- "/"
- Fn::GetAtt:
- ECSService365
- Name
RoleARN:
Fn::GetAtt:
- AutoscalingRole
- Arn
ScalableDimension: ecs:service:DesiredCount
ServiceNamespace: ecs
Type: AWS::ApplicationAutoScaling::ScalableTarget

全栈链接https://github.com/manideep444/cloudformations/blob/master/365sandbox.ymlAWS 文档:Amazon EC2 Auto Scaling 最初仅支持简单的扩展策略。如果您在引入目标跟踪和步骤策略之前创建了扩展策略,则您的策略将被视为简单扩展策略。

enter image description here

最佳答案

“StepAdjustments”应该是 list ,而不是列表中的列表。

以下是 official documentation 中的示例。

StepAdjustments: 
-
MetricIntervalLowerBound: "0"
MetricIntervalUpperBound: "50"
ScalingAdjustment: "1"
-
MetricIntervalLowerBound: "50"
ScalingAdjustment: "2"

关于json - Cloudformation 错误(属性 Step adjustment 的值必须是对象列表),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48910737/

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