

As of November 7, 2025, you can't create new repository associations in Amazon CodeGuru Reviewer. To learn about services with capabilities similar to CodeGuru Reviewer, see [Amazon CodeGuru Reviewer availability change](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/codeguru-reviewer-availability-change.html).

# Add a tag to a CodeGuru Reviewer associated repository
<a name="how-to-tag-associated-repositories-add"></a>

Adding tags to an associated repository can help you identify and organize your AWS resources and manage access to them. First, you add one or more tags (key-value pairs) to an associated repository. Keep in mind that there are limits on the number of tags you can have on an associated repository. There are restrictions on the characters you can use in the key and value fields. For more information, see [Tags](quotas.md#limits-tags). After you have tags, you can create IAM policies to manage access to the associated repository based on these tags. You can use the CodeGuru Reviewer console, AWS CLI, or SDK to add tags to an associated repository. 

**Important**  
Adding tags to an associated repository can impact access to that associated repository. Before you add a tag to an associated repository, make sure to review any IAM policies that might use tags to control access to resources such as associated repositories. For examples of tag-based access policies, see [Using tags to control access to Amazon CodeGuru Reviewer associated repositories](auth-and-access-control-using-tags.md).

**Topics**
+ [Add a tag to a CodeGuru Reviewer associated repository (console)](how-to-tag-associated-repository-add-console.md)
+ [Add a tag to a CodeGuru Reviewer associated repository (AWS CLI)](how-to-tag-associated-repository-add-cli.md)

# Add a tag to a CodeGuru Reviewer associated repository (console)
<a name="how-to-tag-associated-repository-add-console"></a>

You can use the console to add a tag when you create an associated repository or to one that already exists.

**Topics**
+ [Add a tag when you create a CodeGuru Reviewer associated repository (console)](how-to-tag-associated-repository-add-on-create-console.md)
+ [Add a tag to an existing CodeGuru Reviewer associated repository (console)](how-to-tag-associated-repository-add-on-existing-console.md)

# Add a tag when you create a CodeGuru Reviewer associated repository (console)
<a name="how-to-tag-associated-repository-add-on-create-console"></a>

You can use the Amazon CodeGuru Reviewer console to add one or more tags when you create an Amazon CodeGuru Reviewer associated repository. 

**Add a tag when you create an associated repository**

1. Follow the steps in one of the following topics to create an association with your repository type: 
   +  [Create an AWS CodeCommit repository association (console)](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-codecommit-association.html#create-codecommit-association-console) 
   +  [Create a Bitbucket repository association (console)](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-bitbucket-association.html#create-bitbucket-association-console) 
   +  [Create a GitHub or GitHub Enterprise Cloud repository association (console)](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-github-association.html) 
   +  [Create a GitHub Enterprise Server repository association (console)](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-github-enterprise-association.html#create-github-enterprise-association-console) 

1. Expand **Tags**.

1. Choose **Add new tag**.

1. In **Key**, enter a name for the tag. You can add an optional value for the tag in **Value**. 

1. (Optional) To add another tag, choose **Add new tag**.

1. Complete the rest of the steps to create your repository association.

# Add a tag to an existing CodeGuru Reviewer associated repository (console)
<a name="how-to-tag-associated-repository-add-on-existing-console"></a>

You can use the Amazon CodeGuru Reviewer console to add one or more tags to an existing CodeGuru Reviewer associated repository. 

**Add a tag to an existing associated repository**

1. Open the Amazon CodeGuru Reviewer console at [https://console.aws.amazon.com/codeguru/reviewer/](https://console.aws.amazon.com/codeguru/reviewer/).

1. In the navigation pane, choose **Repositories**.

1. Do one of the following: 
   + Choose the association ID of the associated repository where you want to view tags, then choose **Manage tags**.
   + Choose the radio button next to the associated repository where you want to view tags, then choose **Manage tags**.

1. In **Manage tags**, for each tag you want to add: 

   1. Choose **Add new tag**. 

   1. In **key**, enter a name for the tag. 

   1. (Optional) In **value**, enter a value for the tag. 

1. When you have finished adding tags, choose **Save changes**.

# Add a tag to a CodeGuru Reviewer associated repository (AWS CLI)
<a name="how-to-tag-associated-repository-add-cli"></a>

You can use the AWS CLI to add a tag to an associated repository that already exists or when you create it. For information about using the AWS CLI with CodeGuru Reviewer, see the [CodeGuru Reviewer section of the AWS CLI Command Reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/codeguru-reviewer/index.html). 

**Topics**
+ [Add a tag when you create a CodeGuru Reviewer associated repository (AWS CLI)](how-to-tag-associated-repository-add-on-create-cli.md)
+ [Add a tag to an existing CodeGuru Reviewer associated repository (AWS CLI)](how-to-tag-associated-repository-add-on-existing-cli.md)

# Add a tag when you create a CodeGuru Reviewer associated repository (AWS CLI)
<a name="how-to-tag-associated-repository-add-on-create-cli"></a>

You can use the AWS CLI to add tags to an associated repository when you create it. 

**Note**  
Because you cannot use the AWS CLI to create a GitHub repository, you cannot use the AWS CLI to add tags to a GitHub repository when you create it. You can use the AWS CLI to add tags to an existing GitHub repository using **tag-resource**. You can also add tags when you create a GitHub repository association with the console. 

**To add a tag when you create a repository association**

1. Make sure that you have configured the AWS CLI with the AWS Region in which you want to create your code reviews. To verify the Region, run the following command at the command line or terminal and review the information for the default name. 

   ```
   aws configure
   ```

   The default Region name must match the AWS Region for the repository in CodeCommit. 

1. Run the **associate-repository** command specifying the tags you want to add with the `--tags` parameter. Specify a tag's key and value using an equal symbol (for example, `my-key=my-value`). For more information about how to use **associate-repository** to create an association with your repository type, see one of the following: 
   +  [Create a CodeCommit repository association (AWS CLI)](create-codecommit-association.md#create-codecommit-association-cli) 
   +  [Create a Bitbucket repository association (AWS CLI)](create-bitbucket-association.md#create-bitbucket-association-cli) 
   +  [Create a GitHub Enterprise Server repository association (AWS CLI)](create-github-enterprise-association.md#create-github-enterprise-association-cli) 

   The following example adds 3 tags when you create an AWS CodeCommit repository association. 

   ```
   aws codeguru-reviewer associate-repository --repository CodeCommit={Name=my-codecommit-repo} /
   --tags value-1=key-1,owner=admin,status=beta
   ```

1. If successful, this command outputs a [https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html](https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html) object that includes an array with the 3 tags. 

   ```
   {
       "RepositoryAssociation": {
           "AssociationId": "repository-association-uuid",
           "Name": "my-codecommit-repo",
           "LastUpdatedTimeStamp": 1595634764.029,
           "ProviderType": "CodeCommit",
           "CreatedTimeStamp": 1595634764.029,
           "Owner": "123456789012",
           "State": "Associating",
           "StateReason": "Pending Repository Association",
           "AssociationArn": "arn:aws:codeguru-reviewer:us-west-2:123456789012:association:repository-association-uuid",
       },
       "Tags": {
           "owner": "admin",
           "status": "beta",
           "value-1": "key-1",
       }
   }
   ```

# Add a tag to an existing CodeGuru Reviewer associated repository (AWS CLI)
<a name="how-to-tag-associated-repository-add-on-existing-cli"></a>

You use the same command, **tag-resource**, to update and to use the AWS CLI to add tags to an associated repository. 

**To add a tag to an existing repository association**
+ Follow the steps in [Add or update tags for a CodeGuru Reviewer associated repository (AWS CLI)](how-to-tag-associated-repository-update-cli.md). 