Use ListFHIRDatastores with an AWS SDK or CLI - AWS HealthLake

Use ListFHIRDatastores with an AWS SDK or CLI

The following code examples show how to use ListFHIRDatastores.

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
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

For a complete list of AWS SDK developer guides and code examples, see Using HealthLake with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.