Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
How to put Tags on API Gateway V2 Resources using a YAML CloudFormation Template

How to put Tags on the following Resources using a CloudFormation Template:

  • AWS::ApiGatewayV2::Api
  • AWS::ApiGatewayV2::DomainName
  • AWS::ApiGatewayV2::Stage

For a generic AWS::ApiGatewayV2::Api Resource I have tried the following in the Resources section of the CloudFormation Template:

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

In the CloudFormation Events view of Amazon Management Console, The Resource failed with the following reason:

Property validation failure: [Value of property {/Tags} does not match type {Map}]

I looked up the Type, which appeared to be Json in the documentation:

Tags
  The collection of tags. Each tag element is associated with a given resource.
  Required: No
  Type: Json
  Update requires: No interruption
  Required: No

Which made me try the following:

 Tags: !Sub "{ \"TagKey1\" : \"MyFirstTag\", \"TagKey2\" : \"${MySecondTagAsParameter}\"}"

That also did not work, prompting me to try YAML literals:

Tags: !Sub |
  {
    "TagKey1": "MyFirstTag",
    "TagKey2": "${MySecondTagAsParameter}"
  }

That did not work either.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

The following did the trick:

Tags:
  TagKey1: MyFirstTag
  TagKey2: !Ref MySecondTagAsParameter
over 4 years ago · Santiago Trujillo Relatório

0

You were very close to the json-like solution:

      Tags: { "TagKey1": "MyFirstTag",
              "TagKey2": !Ref MySecondTagAsParameter}
over 4 years ago · Santiago Trujillo Relatório

0

For me the following syntax worked:

Tags: 
  - 
    Key: "keyname1"
    Value: "value1"
  - 
    Key: "keyname2"
    Value: "value2"

Source: AWS Documentation

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda