createOrUpdateTags

Creates or updates tags for the specified Auto Scaling group.

When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.

For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.

Samples

import aws.sdk.kotlin.services.autoscaling.model.Tag

fun main() { 
   //sampleStart 
   // This example adds two tags to the specified Auto Scaling group.
autoScalingClient.createOrUpdateTags {
    tags = listOf<Tag>(
        Tag {
            resourceId = "my-auto-scaling-group"
            resourceType = "auto-scaling-group"
            key = "Role"
            value = "WebServer"
            propagateAtLaunch = true
        },
        Tag {
            resourceId = "my-auto-scaling-group"
            resourceType = "auto-scaling-group"
            key = "Dept"
            value = "Research"
            propagateAtLaunch = true
        }            
    )
} 
   //sampleEnd
}