AWS Elastic Beanstalk
Developer Guide
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

Tagging Application Versions

You can apply tags to your AWS Elastic Beanstalk application versions. Tags are key-value pairs associated with AWS resources. For information about Elastic Beanstalk resource tagging, use cases, tag key and value constraints, and supported resource types, see Tagging AWS Elastic Beanstalk Application Resources.

You can specify tags when you create an application version. In an existing application version, you can add or remove tags, and update the values of existing tags. You can add up to 50 tags to each application version.

Adding Tags during Application Version Creation

When you use the Elastic Beanstalk console to create an environment, and you choose to upload a version of your application code, you can specify tag keys and values to associate with the new application version.


        Uploading new application code in the Create New Environment wizard of the Elastic Beanstalk console

You can also use the Elastic Beanstalk console to upload an application version without immediately using it in an environment. You can specify tag keys and values in the Upload Application Version dialog box.


        Upload Application Version dialog box on the Application Versions page of the Elastic Beanstalk console

With the AWS CLI or other API-based clients, add tags by using the --tags parameter on the create-application-version command.

$ aws elasticbeanstalk create-application-version \ --tags Key=mytag1,Value=value1 Key=mytag2,Value=value2 \ --application-name my-app --version-label v1

When you use the EB CLI to create or update an environment, an application version is created from the code that you deploy. There isn't a direct way to tag an application version during its creation through the EB CLI. See the following section to learn about adding tags to an existing application version.

Managing Tags of an Existing Application Version

You can add, update, and delete tags in an existing Elastic Beanstalk application version.

To manage an application version's tags using the Elastic Beanstalk console

  1. Open the Elastic Beanstalk console.

  2. Select the application whose application version you want to manage.

  3. In the side navigation pane, choose Application versions.

  4. Select the application version to manage, and then choose Actions.

  5. Choose Manage tags.

    The Manage Tags dialog box shows the list of tags that are currently applied to the application version.

    
            Manage Tags dialog box shows tags for an application version in the Elastic Beanstalk console
  6. Add, update, or delete tags:

    • To add a tag, enter it into the empty boxes at the bottom of the list.

    • To update a tag's key or value, edit the respective box in the tag's row.

    • To delete a tag, choose 
                Remove tag
              next to the tag's value box.

  7. Choose Apply.

If you use the EB CLI to update your application version, use eb tags to add, update, delete, or list tags.

For example, the following command lists the tags in an application version.

~/workspace/my-app$ eb tags --list --resource "arn:aws-cn:elasticbeanstalk:us-west-2:my-account-id:applicationversion/my-app/my-version"

The following command updates the tag mytag1 and deletes the tag mytag2.

~/workspace/my-app$ eb tags --update mytag1=newvalue --delete mytag2 \ --resource "arn:aws-cn:elasticbeanstalk:us-west-2:my-account-id:applicationversion/my-app/my-version"

For a complete list of options and more examples, see eb tags.

With the AWS CLI or other API-based clients, use the list-tags-for-resource command to list the tags of an application version.

$ aws elasticbeanstalk list-tags-for-resource --resource-arn "arn:aws-cn:elasticbeanstalk:us-west-2:my-account-id:applicationversion/my-app/my-version"

Use the update-tags-for-resource command to add, update, or delete tags in an application version.

$ aws elasticbeanstalk update-tags-for-resource \ --tags-to-add Key=mytag1,Value=newvalue --tags-to-remove mytag2 \ --resource-arn "arn:aws-cn:elasticbeanstalk:us-west-2:my-account-id:applicationversion/my-app/my-version"

Specify both tags to add and tags to update in the --tags-to-add parameter of update-tags-for-resource. A nonexisting tag is added, and an existing tag's value is updated.

Note

To use some of the EB CLI and AWS CLI commands with an Elastic Beanstalk application version, you need the application version's ARN. You can retrieve the ARN by using the following command.

$ aws elasticbeanstalk describe-application-versions --application-name my-app --version-label my-version