There are more AWS SDK examples available in the AWS Doc SDK Examples
Use AddTags
with a CLI
The following code examples show how to use AddTags
.
- CLI
-
- AWS CLI
-
To add a tag to a load balancer
This example adds tags to the specified load balancer.
Command:
aws elb add-tags --load-balancer-name
my-load-balancer
--tags"Key=project,Value=lima"
"Key=department,Value=digital-media"
-
For API details, see AddTags
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example adds the specified tags to the specified load balancer. The syntax used by this example requires PowerShell version 3 or later.
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project";Value="lima" },@{ Key="department";Value="digital-media" }
Example 2: With PowerShell version 2, you must use New-Object to create a tag for the Tag parameter.
$tag = New-Object Amazon.ElasticLoadBalancing.Model.Tag $tag.Key = "project" $tag.Value = "lima" Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag $tag
-
For API details, see AddTags in AWS Tools for PowerShell Cmdlet Reference (V4).
-