Yaml 未解析的资源依赖关系

Yaml 未解析的资源依赖关系,yaml,amazon-cloudformation,Yaml,Amazon Cloudformation,我正在尝试构建我的第一个更大的Cloudformation模板;但是,我在图像选择过程中不断遇到问题,因为它不喜欢我当前的配置 我试图让用户选择一个Windows操作系统版本,然后让CFN模板选择与此Windows版本匹配的AMI yaml Mappings: ImageMapping: WindowsImage: Windows2008R2: ami-0d8a5c68b4550ced5 Windows2012: ami-0196cda92518

我正在尝试构建我的第一个更大的Cloudformation模板;但是,我在图像选择过程中不断遇到问题,因为它不喜欢我当前的配置

我试图让用户选择一个Windows操作系统版本,然后让CFN模板选择与此Windows版本匹配的AMI

yaml    
Mappings: 
  ImageMapping: 
    WindowsImage: 
      Windows2008R2: ami-0d8a5c68b4550ced5
      Windows2012: ami-0196cda9251876643
      Windows2012R2: ami-0196cda9251876643
      Windows2016: ami-04ad37d2932b886c0
      Windows2019: ami-04ad37d2932b886c0
Parameters:
  ImageIdParameters: 
        AllowedValues: 
          - Windows2019
          - Windows2016
          - Windows2012R2
          - Windows2012
          - Windows2008R2
        Default: Windows2019
        Description: "Enter Windows OS Version. Default Windows 2019"
        Type: String
Rescources:
    EC2Instance:
        Properties:
          ImageId: !FindInMap [ImageMapping, !Ref "WindowsImage", !Ref ImageIdParameters]

模板包含错误。模板格式错误:模板的Resources块中未解析的资源依赖项[WindowsImage]应该是
WindowsImage
,而不是
!参考“WindowsImage”

或:

!FindInMap [ImageMapping, WindowsImage, !Ref ImageIdParameters]
ImageId: !FindInMap
  - ImageMapping
  - WindowsImage
  - !Ref ImageIdParameters