在 Cloudformation 中使用 CreditSpecification 创建 t2 实例

Creating a t2 instance with CreditSpecification in Cloudformation

我正在尝试使用 CloudFormation 中的 t2 unlimited burst cpu 选项启动 AWS EC2 实例:

AWSTemplateFormatVersion: 2010-09-09
Resources:
  EC2I1U4EQ:
    Type: 'AWS::EC2::Instance'
    Properties:
      ImageId: ami-403e2524
      InstanceType: t2.small
      CreditSpecification:
        - CpuCredits: unlimited

但是在创建过程中出现错误:

Value of property CreditSpecification must be an object

我找不到任何有关如何形成 CreditSpecification yaml 语句的示例。

欢迎提出任何建议。

According to the doc,是- CPUCredits: unlimited,你少了2个大写字母

只是为了补充 Laurent 的回答,

"Value of property CreditSpecification must be an object"是由于yaml代码错误导致的。如果您使用 CpuCredits 而不是 od CPUCredits,它会抛出 "Unsupported/unknown property error".

然而,解决您的问题很简单。

CreditSpecification:
  CPUCredits: unlimited