Tagging HealthLake data stores
You can assign metadata to HealthLake data stores in the form of tags. Each tag is a label
consisting of a user-defined key and value. Tags help you manage, identify, organize, search
for, and filter data stores.
Do not store protected health information (PHI), personally identifiable information (PII), or other confidential or sensitive information in tags.
Tags are not intended to be used for private or sensitive data.
The following topics describe how to use HealthLake tagging operations using the AWS Management Console,
AWS CLI, and AWS SDKs. For more information, see Tagging your AWS resources in the
AWS General Reference Guide.
Tagging a HealthLake data store
Use TagResource
to tag a HealthLake data store. The following menus provide a
procedure for the AWS Management Console and code examples for the AWS CLI and AWS SDKs. For more
information, see TagResource
in the AWS HealthLake API Reference.
To tag a HealthLake data store
Choose a menu based on your access preference to AWS HealthLake.
- CLI
-
- AWS CLI
-
To add a tag to Data Store
The following tag-resource
example shows how to add a tag to a Data Store.
aws healthlake tag-resource \
--resource-arn "arn:aws:healthlake:us-east-1:691207106566:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe"
\
--tags '[{"Key": "key1", "Value": "value1"}]
' \
--region us-east-1
This command produces no output.
For more information, see 'Adding a tag to a Data Store <https://docs.aws.amazon.com/healthlake/latest/devguide/add-a-tag.html>'__ in the Amazon HealthLake Developer Guide..
- Python
-
- SDK for Python (Boto3)
-
@classmethod
def from_client(cls) -> "HealthLakeWrapper":
"""
Creates a HealthLakeWrapper instance with a default AWS HealthLake client.
:return: An instance of HealthLakeWrapper initialized with the default HealthLake client.
"""
health_lake_client = boto3.client("healthlake")
return cls(health_lake_client)
def tag_resource(self, resource_arn: str, tags: list[dict[str, str]]) -> None:
"""
Tags a HealthLake resource.
:param resource_arn: The resource ARN.
:param tags: The tags to add to the resource.
"""
try:
self.health_lake_client.tag_resource(ResourceARN=resource_arn, Tags=tags)
except ClientError as err:
logger.exception(
"Couldn't tag resource %s. Here's why %s",
resource_arn,
err.response["Error"]["Message"],
)
raise
Can't find what you need? Request a code example using the Provide
feedback link on the right sidebar of this page.
-
Sign in to the Data stores page on the HealthLake Console.
-
Choose a data store.
The Data store details page opens.
-
Under the Tags section, choose Manage
tags.
The Manage tags page opens.
-
Choose Add new tag.
-
Enter a Key and Value (optional).
-
Choose Save.
Use ListTagsForResource
to list tags for a HealthLake data store. The following
menus provide a procedure for the AWS Management Console and code examples for the AWS CLI and AWS SDKs.
For more information, see ListTagsForResource
in the AWS HealthLake API
Reference.
To list tags for a HealthLake data store
Choose a menu based on your access preference to AWS HealthLake.
- CLI
-
- AWS CLI
-
To list tags for a Data Store
The following list-tags-for-resource
example lists the tags associated with the specified Data Store.:
aws healthlake list-tags-for-resource \
--resource-arn "arn:aws:healthlake:us-east-1:674914422125:datastore/fhir/0725c83f4307f263e16fd56b6d8ebdbe"
\
--region us-east-1
Output:
{
"tags": {
"key": "value",
"key1": "value1"
}
}
For more information, see Tagging resources in Amazon HealthLake in the Amazon HealthLake Developer Guide.
- Python
-
- SDK for Python (Boto3)
-
@classmethod
def from_client(cls) -> "HealthLakeWrapper":
"""
Creates a HealthLakeWrapper instance with a default AWS HealthLake client.
:return: An instance of HealthLakeWrapper initialized with the default HealthLake client.
"""
health_lake_client = boto3.client("healthlake")
return cls(health_lake_client)
def list_tags_for_resource(self, resource_arn: str) -> dict[str, str]:
"""
Lists the tags for a HealthLake resource.
:param resource_arn: The resource ARN.
:return: The tags for the resource.
"""
try:
response = self.health_lake_client.list_tags_for_resource(
ResourceARN=resource_arn
)
return response["Tags"]
except ClientError as err:
logger.exception(
"Couldn't list tags for resource %s. Here's why %s",
resource_arn,
err.response["Error"]["Message"],
)
raise
Can't find what you need? Request a code example using the Provide
feedback link on the right sidebar of this page.
-
Sign in to the Data stores page on the HealthLake Console.
-
Choose a data store.
The Data store details page opens. Under the
Tags section, all data store tags are listed.
Untagging a HealthLake data
store
Use UntagResource
to remove a tag from a HealthLake data store. The following
menus provide a procedure for the AWS Management Console and code examples for the AWS CLI and AWS SDKs.
For more information, see UntagResource
in the AWS HealthLake API
Reference.
To untag a HealthLake data store
Choose a menu based on your access preference to AWS HealthLake.
- CLI
-
- AWS CLI
-
To remove tags from a Data Store.
The following untag-resource
example shows how to remove tags from a Data Store.
aws healthlake untag-resource \
--resource-arn "arn:aws:healthlake:us-east-1:674914422125:datastore/fhir/b91723d65c6fdeb1d26543a49d2ed1fa"
\
--tag-keys '["key1"]
' \
--region us-east-1
This command produces no output.
For more information, see Removing tags from a Data Store in the Amazon HealthLake Developer Guide.
- Python
-
- SDK for Python (Boto3)
-
@classmethod
def from_client(cls) -> "HealthLakeWrapper":
"""
Creates a HealthLakeWrapper instance with a default AWS HealthLake client.
:return: An instance of HealthLakeWrapper initialized with the default HealthLake client.
"""
health_lake_client = boto3.client("healthlake")
return cls(health_lake_client)
def untag_resource(self, resource_arn: str, tag_keys: list[str]) -> None:
"""
Untags a HealthLake resource.
:param resource_arn: The resource ARN.
:param tag_keys: The tag keys to remove from the resource.
"""
try:
self.health_lake_client.untag_resource(
ResourceARN=resource_arn, TagKeys=tag_keys
)
except ClientError as err:
logger.exception(
"Couldn't untag resource %s. Here's why %s",
resource_arn,
err.response["Error"]["Message"],
)
raise
Can't find what you need? Request a code example using the Provide
feedback link on the right sidebar of this page.
-
Sign in to the Data stores page on the HealthLake Console.
-
Choose a data store.
The Data store details page opens.
-
Under the Tags section, choose Manage tags.
The Manage tags page opens.
-
Choose Remove next to the tag you want to remove.
-
Choose Save.