小编Had*_*ous的帖子

属性验证失败:YAML 中的 AWS::SSM::Parameter [属性值 {/Tags} 与类型 {Map} 不匹配]

以下代码片段:

AWSTemplateFormatVersion: '2010-09-09'
Description: Some CloudFormation template

Resources:
  MyResourceName:
    Type: AWS::SSM::Parameter
    Properties:
      Name: myParameterName
      Type: String
      Value: "somevalue"
      Tags:
        - Key: firstTagName
          Value: firstTagValue
        - Key: secondTagName
          Value: secondTagValue
Run Code Online (Sandbox Code Playgroud)

在 CloudFormation 中生成以下错误:

属性验证失败:CloudFormation 中 AWS::SSM::Parameter 的 [属性值 {/Tags} 与类型 {Map} 不匹配]

我应该如何正确构建 Tags 属性?

amazon-web-services aws-cloudformation aws-ssm

8
推荐指数
1
解决办法
5629
查看次数

如何使用 YAML CloudFormation 模板在 API Gateway V2 资源上添加标签

如何使用 CloudFormation 模板在以下资源上添加标签:

  • AWS::ApiGatewayV2::Api
  • AWS::ApiGatewayV2::域名
  • AWS::ApiGatewayV2::Stage

对于通用 AWS::ApiGatewayV2::Api 资源,我在 CloudFormation 模板的资源部分尝试了以下操作:

MyApi:
  Type: 'AWS::ApiGatewayV2::Api'
  Properties:
    Name: MyApi
    ProtocolType: WEBSOCKET
    RouteSelectionExpression: $request.body.action
    ApiKeySelectionExpression: $request.header.x-api-key
    Tags:
      - Key: TagKey1
        Value: MyFirstTag
      - Key: TagKey2
        Value: !Ref MySecondTagAsParameter
Run Code Online (Sandbox Code Playgroud)

在 Amazon 管理控制台的 CloudFormation Events 视图中,资源失败,原因如下:

属性验证失败:[属性值 {/Tags} 与类型 {Map} 不匹配]

我查找了类型,它似乎在文档Json中:

Tags
  The collection of tags. Each tag element is associated with a given resource.
  Required: No
  Type: Json
  Update requires: No interruption
  Required: No
Run Code Online (Sandbox Code Playgroud)

这让我尝试了以下方法:

 Tags: !Sub "{ \"TagKey1\" : …
Run Code Online (Sandbox Code Playgroud)

yaml amazon-web-services aws-cloudformation aws-api-gateway

3
推荐指数
1
解决办法
1944
查看次数