Tagging resources
Tags are a key-value pair that are applied to AWS resources to hold metadata. Tags are often used to decorate resources with metadata that helps categorize resources for billing or viewing purposes. Learn more about tags by visiting the AWS documentation for best practices for tagging resources.
Amplify applies the following tags by default:
Deployment type | Tag key | Tag value |
---|---|---|
sandbox | created-by | amplify |
sandbox | amplify:deployment-type | sandbox |
branch | created-by | amplify |
branch | amplify:deployment-type | branch |
branch | amplify:app-id | <your-amplify-app-id> |
branch | amplify:branch-name | <your-git-branch-name> |
In your Amplify backend you can use the Tags
class from the AWS Cloud Development Kit (CDK) to apply tags at the root level, which then cascades to child resources.
amplify/backend.ts
import { Tags } from 'aws-cdk-lib';import { defineBackend } from '@aws-amplify/backend';import { auth } from './auth/resource';import { data } from './data/resource';
/** * @see https://docs.amplify.aws/react/build-a-backend/ to add storage, functions, and more */const backend = defineBackend({ auth, data});
const tags = Tags.of(backend.stack);// add a new tagtags.add('my-key', 'my-value');// remove tagstags.remove('my-key');