Listing HealthLake data stores
Use ListFHIRDatastores
to list all HealthLake data stores in a user's account,
regardless of data store status. 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 ListFHIRDatastores
in the AWS HealthLake API
Reference.
To list all HealthLake data stores
Choose a menu based on your access preference to AWS HealthLake.
- CLI
-
- AWS CLI
-
To list FHIR Data Stores
The following list-fhir-datastores
example shows to how to use the command and how users can filter results based on Data Store status in Amazon HealthLake.
aws healthlake list-fhir-datastores \
--region us-east-1
\
--filter DatastoreStatus=ACTIVE
Output:
{
"DatastorePropertiesList": [
{
"PreloadDataConfig": {
"PreloadDataType": "SYNTHEA"
},
"DatastoreName": "FhirTestDatastore",
"DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Datastore ID>",
"DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Datastore ID>/r4/",
"DatastoreStatus": "ACTIVE",
"DatastoreTypeVersion": "R4",
"CreatedAt": 1605574003.209,
"DatastoreId": "<Datastore ID>"
},
{
"DatastoreName": "Demo",
"DatastoreArn": "arn:aws:healthlake:us-east-1:<AWS Account ID>:datastore/<Datastore ID>",
"DatastoreEndpoint": "https://healthlake.us-east-1.amazonaws.com/datastore/<Datastore ID>/r4/",
"DatastoreStatus": "ACTIVE",
"DatastoreTypeVersion": "R4",
"CreatedAt": 1603761064.881,
"DatastoreId": "<Datastore ID>"
}
]
}
For more information, see Creating and monitoring a FHIR 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 list_fhir_datastores(self) -> list[dict[str, any]]:
"""
Lists all HealthLake data stores.
:return: A list of data store descriptions.
"""
try:
next_token = None
datastores = []
# Loop through paginated results.
while True:
parameters = {}
if next_token is not None:
parameters["NextToken"] = next_token
response = self.health_lake_client.list_fhir_datastores(**parameters)
datastores.extend(response["DatastorePropertiesList"])
if "NextToken" in response:
next_token = response["NextToken"]
else:
break
return datastores
except ClientError as err:
logger.exception(
"Couldn't list data stores. Here's why %s", 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.