amazon-web-services - Cloudformation - 在 map 中定义默认值

标签 amazon-web-services yaml aws-cloudformation

我想通过以下方式访问值MyVar:

 '!FindInMap [!Ref Stage, !Ref AWS::Region, MyVar]'
Mappings:
  stage1:
    us-west-2:
      MyVar: 15
  stage2:
    us-west-2:
      MyVar: 15
  stage3:
    eu-west-1:
      MyVar: 20
    us-east-1:
      MyVar: 30

我必须定义映射中不存在的阶段变量(用户名-stage1)。有没有办法可以定义默认值?我想要一个功能,

If matching key1, key2 not found, return MyVar as 0.

最佳答案

遗憾的是,CloudFormation for Mappings 中没有此类功能。您可以为参数设置默认值,如果这有帮助的话。

关于amazon-web-services - Cloudformation - 在 map 中定义默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63255643/

相关文章:

node.js - 负载均衡 Amazon EC2 上的 Node socket.io

oracle - Oracle DB 中 ENUM 列的 Liquibase 'addCheckConstraint' 允许任何字符

amazon-web-services - 如何通过 Cloudformation 将弹性 IP 连接到 Nat 网关

aws-cloudformation - 调用CreateChangeSet操作时发生错误(ValidationError): Parameters: [UserDataS3script] must have values

amazon-ec2 - EC2 实例 Cloudformation - 可用区作为参数传递

amazon-web-services - 如果 EKS 工作节点位于私有(private)子网中,则 ELB 停止服务

amazon-web-services - 您目前无法使用 Aurora Serverless 修改 MaintenanceWindow - 更新 Cloudformation 堆栈时出错

amazon-web-services - 迭代模板中的 AWS cloudformation 资源数组

symfony - 将 Memcached 服务添加到 symfony2

kubernetes - 将Kubernetes的docker run转换为YAML