AWS cloud formation Template- providing Tags for the stack in the template

后端 未结 2 477
逝去的感伤
逝去的感伤 2021-02-03 20:21

We wanted to use company specific Tags to the resources that we create in AWS for billing purposes. I am using a cloud formation template to spin up our Elasticbeanstalk instanc

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 21:07

    When launching AWS CloudFormation, the tags being requested will be applied to the CloudFormation Stack itself and (where possible) will also be propagated to the resources launched by the Stack.

    These tags can be passed to the CreateStack API call, or from the CLI:

    • See: create-stack CLI documentation

    These tags are applied to the whole Stack and aren't included in the CloudFormation template.

    However, CloudFormation templates can include tags for specific resources that are being created. For example, when launching Amazon EC2 instances, tags can be included in the template:

    "MyInstance" : {
        "Type" : "AWS::EC2::Instance",
        "Properties" : {
            "SecurityGroups" : [ { "Ref" : "MySecurityGroup" } ],
            "AvailabilityZone" : "us-east-1a",
            "ImageId" : "ami-20b65349",
            "Volumes" : [
                { "VolumeId" : { "Ref" : "MyEBS" },
                           "Device" : "/dev/sdk" }
            ],
            "Tags" : [
                {
                    "Key" : "Stage",
                    "Value" : "QA"
                }
           ]
        }
    }
    

提交回复
热议问题