Adding tags to Amazon Personalize resources
You can add, display, update, and remove tag keys and values from Amazon Personalize resources with the Amazon Personalize console, Amazon Command Line Interface (Amazon CLI), or Amazon SDKs. The following examples show how to add a tag to Amazon Personalize dataset group. You can add tags to other Amazon Personalize resources in the same way.
Adding tags (console)
When you create a resource in Amazon Personalize, you can add optional tags with the Amazon Personalize console. The following example adds a tag to a dataset group.
To add tags to a new dataset group
-
Open the Amazon Personalize console at https://console.amazonaws.cn/personalize/home
and sign in to your account. -
Choose Create dataset group.
-
For Name, enter a name.
-
For Domain, choose a domain.
-
Expand the Tags section and choose Add new tag.
-
For Key and Value, enter appropriate values.
For example,
Environment
andTest
, respectively. -
To add more tags, choose Add new tag.
You can add up to 50 tags to a resource.
-
Choose Next to continue creating your resource.
Adding tags to an existing resource is similar: Choose your resource and use the Tags fields to add your tags.
Adding tags (Amazon CLI)
You can use the Amazon Command Line Interface (Amazon CLI) to add tags when you create a resource or add tags to an existing resource.
Adding tags when you create a resource
To create a new resource and add a tag to it with the Amazon CLI, use the appropriate
create
command for the resource and include the tags
parameter
and values. For example, the following command creates a new Domain dataset group named
myDatasetGroup
for the ECOMMERCE domain, and adds the following tags: An
Environment
tag key with a Test
tag value, and a
Owner
tag key and a xyzCorp
value.
aws personalize create-dataset-group \ --name myDatasetGroup \ --domain ECOMMERCE \ --tags tagKey=Environment,tagValue=Test tagKey=Owner,tagValue=xyzCorp
For information about the commands that you can use to create an Amazon Personalize resource, see the Amazon Personalize Amazon CLI Command Reference.
Adding tags to an existing resource
To add a tag to an existing resource, use the tag-resource
command. Specify the ARN of the
resource and provide the tag key and value in the tags
parameter.
aws personalize tag-resource \ --resource-arn
resource ARN
\ --tags tagKey=key
,tagValue=value
Adding tags (Amazon SDKs)
You can use the Amazon SDKs to add tags when you create a resource, or to add tags to an existing resource.
Adding tags when you create a resource
To create a new resource and add a tag to it with the Amazon SDKs, use the appropriate
create
method. Use the tags
parameter to specify the key-value
pairs for each of your tags. For example, the following code creates a new
Domain dataset group named myDatasetGroup
for the ECOMMERCE domain and adds
the following tags: An Environment
tag key with a Test
tag
value, and a Owner
tag key and a xyzCorp
value.
Adding tags to an existing resource
The following code shows how to add a tag to an existing Amazon Personalize resource. Specify the Amazon Resource Name (ARN) of the resource that you want to add tags to and specify key-value pairs for each of your tags.