相关疑难解决方法(0)

CloudFormation yaml - 如何强制数字类型?

我正在尝试创建 ECS 任务定义作为 CloudFormation 堆栈的一部分。

到目前为止我的任务定义看起来像这样......

  TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      RequiresCompatibilities:
        - EC2
      ExecutionRoleArn: !Ref MyTaskRole
      ContainerDefinitions:
        - Name: !Ref ServiceName
          Image: amazon/amazon-ecs-sample
          PortMappings:
            - ContainerPort: 3000
              HostPort: 0
              Protocol: tcp
          MemoryReservation: 128
Run Code Online (Sandbox Code Playgroud)

当我尝试运行此程序时,出现以下错误...

#/ContainerDefinitions/0/MemoryReservation: expected type: Number, found: String
Run Code Online (Sandbox Code Playgroud)

所以看来CloudFormation正在将128转换为字符串,然后堆栈失败。

定义该值以使其保持为数字的正确方法是什么?

yaml aws-cloudformation

5
推荐指数
1
解决办法
2914
查看次数

标签 统计

aws-cloudformation ×1

yaml ×1