yaml - CloudFormation 提到架构版本 2.2 需要文档类型

标签 yaml aws-cloudformation amazon-systems-manager aws-ssm

浏览器AWS控制台的cloudformation服务的堆栈上显示以下错误。

Document type is required for schema version 2.2 (Service: AmazonSSM; Status Code: 400; Error Code: InvalidDocumentSchemaVersion; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

CloudFormation 文档中的以下资源发生了这种情况:

InstanceConfigDocument:
  Type: AWS::SSM::Document
  Properties:
    Content:
      schemaVersion: "2.2"
      description: Join Active Directory
      mainSteps:
        - action: aws:domainJoin
          name: joiningDomain
          inputs:
            directoryId: !Ref ActiveDirectory
            directoryName: myDirectoryName
            dnsIpAddresses:
              - !Select ['0', !GetAtt 'ActiveDirectory.DnsIpAddresses']
              - !Select ['1', !GetAtt 'ActiveDirectory.DnsIpAddresses']

如何解决这个错误?

最佳答案

添加 DocumentType 属性对我有用。

  InstanceConfigDocument:
    Type: AWS::SSM::Document
    Properties:
      DocumentType: "Command"
      Content:
        schemaVersion: "2.2"
        description: Join Active Directory
        mainSteps:
          - action: aws:domainJoin
            name: joiningDomain
            inputs:
              directoryId: !Ref ActiveDirectory
              directoryName: myDirectoryName
              dnsIpAddresses:
                - !Select ['0', !GetAtt 'ActiveDirectory.DnsIpAddresses']
                - !Select ['1', !GetAtt 'ActiveDirectory.DnsIpAddresses']

CloudFormation Documentation引用 DocumentType 不是必需的。使用架构版本 2.2 的 SSM 文档似乎需要它。

关于yaml - CloudFormation 提到架构版本 2.2 需要文档类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61821339/

相关文章:

amazon-web-services - CloudWatch Events 规则未使用标签查找 EC2 目标

aws-cloudformation - 如何在 AWS Cloudformation 模板中创建 CodeCommit 分支以及 CodeCommit 存储库?

amazon-web-services - 如何在 AWS 的 Systems Manager 参数存储中检查已删除参数的日志

python - 如何使用python yaml解析内部变量?

azure devops yaml管道未设置变量

amazon-web-services - Auto Scaling 组不会在启动配置更改时更新

amazon-web-services - AWS Cloud Formation Stack 的创建和计划删除

yaml - 模板格式错误 : YAML not well-formed. 删除禁止的属性错误

python - 如何计算 YAML 中定义的代数表达式?