如何在CloudFormation模板中命名Auto Scaling组? [英] How to name an Auto Scaling Group in a CloudFormation template?

查看:189
本文介绍了如何在CloudFormation模板中命名Auto Scaling组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CloudFormation模板,可以创建一个自动缩放组(除其他外)。如何在模板中为自动伸缩组命名?

AWS文档未提及任何内容( http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html ),并可能如果我通过AWS网站创建它,该怎么办。 (我需要给一个组命名,因为我需要从另一个脚本中找到该组)

I have a CloudFormation template that creates an auto scaling group (among other things). How can I give the auto scaling group a name in the template?
The AWS docs do not mention anything (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html), and its possible to do if I create it trough the AWS website. (I need to give a group a name because I need to find this group from another script)

编辑:我试图添加一个名为名称的标签,但它仍然不起作用:

I've tried to add a tag called "Name", but it still does not work:

"Resources": {
"MyServerGroup" : {
  "Type" : "AWS::AutoScaling::AutoScalingGroup",
  "Properties" : {
    "AvailabilityZones" : { "Fn::GetAZs" : ""},
    "LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
    "MinSize" : { "Ref" : "ServerCount" },
    "MaxSize" : { "Ref" : "ServerCount" },
    "DesiredCapacity" : { "Ref" : "ServerCount" },
    "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancerName" } ],
    "Tags" : [ {
      "Key" : "Name",
      "Value" : { "Ref" : "ServerName" },
      "PropagateAtLaunch" : "true"
    } ]
  },
  "CreationPolicy": {
    "ResourceSignal": {
      "Count": "2",
      "Timeout": "PT5M"
    }
  }
},

AWS控制台中的名称列仍显示 MyStackName-MyServerGroup-345MH3NF34N7E之类的内容,在标签字段中,我可以看到添加的名称标签的键值对。

The name column in the AWS console still displays something like "MyStackName-MyServerGroup-345MH3NF34N7E", and in the Tags field I can see the key-value pair for the Name tag that I added.

推荐答案

CloudFormation现在具有名为:AutoScalingGroupName

CloudFormation now has a property called: AutoScalingGroupName

Description的属性: Auto Scaling组的名称。最小长度为1。最大长度为255。必须遵循以下模式:[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n \t] *
类型:字符串
必需:否

Description: "The name of the Auto Scaling group. Minimum length of 1. Maximum length of 255. Must follow the following pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*" Type: String Required: No

请参见 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as- group.html

这篇关于如何在CloudFormation模板中命名Auto Scaling组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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