有没有一种方法可以参数化云形成资源名称? [英] Is there a way to parameterize cloud formation resource names?

查看:50
本文介绍了有没有一种方法可以参数化云形成资源名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使云形成模板上的AutoScalingGroup名称动态化。我在想是否可以通过参数或其他方式实现?

I'm trying to make AutoScalingGroup names on cloud formation templates dynamic. I was thinking if this is possible via parameters, or any other way?

"DynamicASGName": {
      "Type": "AWS::AutoScaling::AutoScalingGroup",
      "Properties": {
      ...properties here...
      }
    }


推荐答案

CloudFormation使用两套名称:逻辑资源名称,用于标识内部的资源。

CloudFormation uses two sets of names: the logical resource name, to identify a resource within the stack, and the physical name which uniquely identifies it across the whole region.

CloudFormation不支持动态设置逻辑名称,但是对于某些类型,您可以设置模板中具有名称属性的物理名称。不幸的是, AutoScalingGroup 不支持此功能。

CloudFormation doesn't support setting the logical name dynamically, but with certain types, you can set the physical name in the template with the Name property. Unfortunately, AutoScalingGroup doesn't support this.

更好的解决方案可能是在资源上使用标签。大多数AWS资源类型(包括 AutoScalingGroup )都支持标签,并且可以在CloudFormation模板中动态设置它们。

A better solution is probably to use Tags on your resources. Most AWS resource types (including AutoScalingGroup) support Tags and they can be set dynamically in a CloudFormation template.

这篇关于有没有一种方法可以参数化云形成资源名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆