简体   繁体   English

在CloudFormation中使用堆栈标签

[英]Use Tags of Stack in CloudFormation

I am quite new at designing CloudFormation Template, is it possible to use stack tags value defined just before launching the stack creation inside the template? 我在设计CloudFormation模板时还很陌生,是否可以在模板内部启动堆栈创建之前使用定义的堆栈标签值?

For example : 例如 :

"EC2I2C2EJ": {
   "Type": "AWS::EC2::Instance",
      "Properties": {
      "AvailabilityZone": "eu-west-3a",
      "ImageId": "ami-0152e5e7567b014fc",
      "InstanceType": { "Ref" : "Type" }
   }
}

在此处输入图片说明

Yes you can apply tags to the Cloudformation stack without having to manually fill them in through the Create Stack Wizard however this needs to be done over the CLI or using Boto3/CreateStack API call. 是的,您可以将标签应用于Cloudformation堆栈,而无需通过“创建堆栈向导”手动填写它们,但这需要通过CLI或使用Boto3 / CreateStack API调用来完成。 Tags will automatically be added to your Cloudformation stack via this method and these tags will also - where appropriate - propagate onto resources you launch, ie the EC2 instance you are creating. 标签将通过此方法自动添加到您的Cloudformation堆栈中,并且这些标签还将(在适当情况下)传播到您启动的资源(即正在创建的EC2实例)上。

You can add tags inside the Cloudformation template like so for specific resources: 您可以像这样针对特定资源在Cloudformation模板内添加标签:

"EC2I2C2EJ": {
  "Type": "AWS::EC2::Instance",
  "Properties": {
  "AvailabilityZone": "eu-west-3a",
  "ImageId": "ami-0152e5e7567b014fc",
  "InstanceType": { "Ref" : "Type" },
  "Tags" : [
        {
            "Key" : "Tag1",
            "Value" : "Test"
        },
   ]
 }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将堆栈标记传递给Cloudformation中的嵌套堆栈 - Pass stack tags to nested stack in Cloudformation CloudFormation 不传播 EMR 的堆栈级标签 - CloudFormation is not propagating stack-level tags for EMR 在 cloudformation 模板中设置堆栈级别标签 - 而不是在嵌套堆栈中 - set stack level tags in a cloudformation template- not in a nested stack aws cli cloudformation update-stack 设置标签? - aws cli cloudformation update-stack set tags? 是否可以在创建 CloudFormation 堆栈后将标签添加到它? - Is it possible to just add tags to CloudFormation stack after it is created? 如何使用boto3获取分配给cloudformation堆栈的标签? - How to obtain tags assigned to cloudformation stack using boto3? 如何使用一个CloudFormation堆栈中的SQS队列作为另一CloudFormation堆栈中的lambda函数的触发器? - How do I use an SQS queue in one CloudFormation stack as a trigger to a lambda function in another CloudFormation stack? 我们可以通过标记策略在 CloudFormation 堆栈(级别)上强制执行某些 aws 标签吗? - Can we enforce certain aws tags on CloudFormation stack(level) via Tagging policy? Cloudformation堆栈版本控制 - Cloudformation Stack Versioning CloudFormation 中的嵌套堆栈 - Nested Stack in CloudFormation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM