Adding or Removing Tags to Your Load Balancers

You can add tags to your existing resources to identify and categorize them. Tags enable you to make an inventory of your resources.

Working with tags in Load Balancing Unit (LBU) is the same as in Flexible Compute Unit (FCU). For more information, see About Tags.

Adding or Removing Tags Using OSC CLI

Adding Tags Using OSC CLI

The CreateLoadBalancerTags command adds one or more tags to the specified load balancers.
If a tag with the same key already exists for the load balancer, the tag value is replaced.

For more information, see About Tags.

Request sample
$ osc-cli api CreateLoadBalancerTags --profile "default" \
    --LoadBalancerNames '["private-lb-example"]' \
    --Tags '[
        {
          "Key": "key1",
          "Value": "value1"
        }
      ]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LoadBalancerNames: One or more load balancer names.

  • Tags: One or more tags to add to the specified load balancers.

    • Key: (optional) The key of the tag, with a minimum of 1 character.

    • Value: (optional) The value of the tag, between 0 and 255 characters.

The CreateLoadBalancerTags command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Removing Tags Using OSC CLI

The DeleteLoadBalancerTags command deletes one or more tags from the specified load balancers.

Request sample
$ osc-cli api DeleteLoadBalancerTags --profile "default" \
    --LoadBalancerNames '["example-lbu"]' \
    --Tags '[
        {
          "Key": "key1"
        }
      ]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LoadBalancerNames: One or more load balancer names.

  • Tags: One or more tags to delete from the load balancers.

    • Key: (optional) The key of the tag, with a minimum of 1 character.

The DeleteLoadBalancerTags command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Adding or Removing Tags Using oapi-cli

Adding Tags Using oapi-cli

The CreateLoadBalancerTags command adds one or more tags to the specified load balancers.
If a tag with the same key already exists for the load balancer, the tag value is replaced.

For more information, see About Tags.

Request sample
$ oapi-cli --profile "default" CreateLoadBalancerTags \
    --LoadBalancerNames '["private-lb-example"]' \
    --Tags '[
        {
          "Key": "key1",
          "Value": "value1"
        }
      ]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LoadBalancerNames: One or more load balancer names.

  • Tags: One or more tags to add to the specified load balancers.

    • Key: (optional) The key of the tag, with a minimum of 1 character.

    • Value: (optional) The value of the tag, between 0 and 255 characters.

The CreateLoadBalancerTags command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Removing Tags Using oapi-cli

The DeleteLoadBalancerTags command deletes one or more tags from the specified load balancers.

Request sample
$ oapi-cli --profile "default" DeleteLoadBalancerTags \
    --LoadBalancerNames '["example-lbu"]' \
    --Tags '[
        {
          "Key": "key1"
        }
      ]'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LoadBalancerNames: One or more load balancer names.

  • Tags: One or more tags to delete from the load balancers.

    • Key: (optional) The key of the tag, with a minimum of 1 character.

The DeleteLoadBalancerTags command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Adding or Removing Tags Using AWS CLI

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

Adding Tags Using AWS CLI

To add one or more tags, use the add-tags command following this syntax:

Request sample
$ aws elb add-tags \
    --profile YOUR_PROFILE \
    --load-balancer-names LOAD_BALANCER ANOTHER_LOAD_BALANCER \
    --tags Key=KEY1,Value=VALUE1 Key=KEY2,Value=VALUE2 \
    --endpoint https://lbu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • load-balancer-names: The names of the load balancers for which you want to add tags.

  • tags: The tags you want to add to the specified load balancers. This attribute contains the following elements that you need to specify:

    • Key: The key of the tag.

    • (optional) Value: The value of the tag.

      The tag value must contain 255 characters maximum. However, there is no maximum length for the tag key.

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

The specified tags are added to the specified resources.

Removing Tags Using AWS CLI

To remove one or more tags, use the remove-tags command following this syntax:

Request sample
$ aws elb remove-tags \
    --profile YOUR_PROFILE \
    --load-balancer-names LOAD_BALANCER ANOTHER_LOAD_BALANCER \
    --tags KEY1 KEY2 \
    --endpoint https://lbu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • load-balancer-names: The names of the load balancers for which you want to remove tags.

  • tags: The keys of the tags you want to remove from the specified load balancers.

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

The specified tags are removed from the specified resources.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.