

# Tagging AWS App Monetization resources

A *tag* is a label that you assign to an AWS resource. Each tag consists of a key and a value. You can use tags to organize your AWS App Monetization resources and to control access to them with IAM policies.

**Note**  
You can manage tags with the AWS App Monetization API or the AWS CLI. The console doesn't show tags yet.

## Resources that you can tag
<a name="tagging-resources"></a>

You can tag the following AWS App Monetization resources. Identify a resource by its ARN.


| Resource | ARN format | 
| --- | --- | 
| App | `arn:aws:appmonetization:{{region}}:{{account-id}}:apps/{{app-id}}` | 
| Pricing plan | `arn:aws:appmonetization:{{region}}:{{account-id}}:apps/{{app-id}}/plans/{{plan-id}}` | 
| Metric | `arn:aws:appmonetization:{{region}}:{{account-id}}:apps/{{app-id}}/metrics/{{metric-id}}` | 
| One-time price | `arn:aws:appmonetization:{{region}}:{{account-id}}:apps/{{app-id}}/one-time-price/{{one-time-price-id}}` | 

## Tag restrictions
<a name="tagging-restrictions"></a>

The following restrictions apply to tags on AWS App Monetization resources:
+ A resource can have at most 50 tags. A request can add at most 50 tags or remove at most 50 tag keys.
+ A tag key is 1 to 128 characters long. A tag value is 0 to 256 characters long.
+ Keys and values can contain letters, numbers, spaces, and the following characters: `_ . : / = + - @`
+ A tag key can't begin with `aws:` in any combination of uppercase and lowercase letters. This prefix is reserved for AWS use.
+ One request can't contain tag keys that differ only in letter case, such as `Team` and `team`.

## Working with tags
<a name="tagging-api"></a>

You can add tags when you create a resource, and add, remove, and list tags on an existing resource. The following table lists the AWS App Monetization API operations that you use.


| Task | API operation | 
| --- | --- | 
| Add tags when you create a resource | Use the `tags` parameter of `CreateApp`, `CreatePlan`, `CreateMetric`, or `CreateOneTimePrice`. You also need permission for `appmonetization:TagResource`. | 
| Add tags or change the value of an existing tag | `TagResource`. A tag whose key already exists on the resource has its value overwritten. | 
| Remove tags | `UntagResource`. A key that isn't on the resource is ignored. | 
| List the tags on a resource | `ListTagsForResource` | 

For details about each operation, see the [AWS App Monetization API Reference](https://docs.aws.amazon.com/appmonetization/latest/APIReference/).

The following AWS CLI command adds two tags to an existing app. In the command, replace `111122223333` with your account ID and `01a1EXAMPLEAPPID7f3e2b1c` with the ID of your app.

```
PROMPT> aws appmonetization tag-resource \
    --region us-east-2 \
    --resource-arn arn:aws:appmonetization:us-east-2:111122223333:apps/01a1EXAMPLEAPPID7f3e2b1c \
    --tags Team=payments,Environment=production
```

The command uses the following parameters:
+ `--region` – The AWS Region of the app.
+ `--resource-arn` – The ARN of the resource to tag.
+ `--tags` – The tags to add, as `key=value` pairs separated by commas. Replace `Team=payments,Environment=production` with your own tag keys and values.

The following AWS CLI command creates an app with a tag. In the command, replace {{app-name}}, shown in italics, with the name of your app.

```
PROMPT> aws appmonetization create-app \
    --region us-east-2 \
    --name {{app-name}} \
    --tags Team=payments
```

## Using tags to control access
<a name="tagging-access-control"></a>

You can use tags in the condition element of an IAM policy to control access to AWS App Monetization resources. For the condition keys that AWS App Monetization supports, see [ABAC with AWS App Monetization](security_iam_service-with-iam.md#security_iam_service-with-iam-tags). For an example policy, see [Deny deleting apps tagged as production](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-deny-delete-production).