Creating a data store in AWS HealthLake - AWS HealthLake

Creating a data store in AWS HealthLake

After you complete Setting up permissions to start using AWS HealthLake, you are ready to create a data store. In AWS HealthLake, you use a data store to store data in HL7 FHIR (R4) format. The topics in this chapter describe how to create a data store.

To both create analytics enabled data stores and to grant access to them in Athena, add the AWSLakeFormationDataAdmin managed policy to your IAM user, group or role. The AWSLakeFormationDataAdmin policy allows you to create data lake administrators and to grant access to data stores in Athena. For information about setting permissions, see Setting up permissions to start using AWS HealthLake.

HealthLake is also integrated with AWS CloudTrail. You can use CloudTrail to provide a record of actions taken by a user, role, or an AWS service in HealthLake. CloudTrail captures all API calls and console actions for HealthLake as events. To learn more, see Logging AWS HealthLake API Calls with AWS CloudTrail.

To learn more about the Fast Healthcare Interoperability Resources (FHIR) resource types that are supported by HealthLake, see Supported FHIR resource types in AWS HealthLake.

Amazon Athena compatibility

HealthLake date stores created prior to November, 14, 2022 cannot perform SQL queries using Athena. To use Athena search capabilities on your preexisting data store, first migrate the data to a new data store. To learn more about migrating preexisting data stores, see Migrating an existing data store to use Amazon Athena.

After you create a data store, you can get its properties, including its status, with the API_DescribeFHIRDatastore or API_ListFHIRDatastores.html API operations. Or you can find data store statuses and other details on the Data stores page in the HealthLake console.

A HealthLake data store can have the following statuses:

  • Creating – Your data store is being created.

  • Active – Your data store is active. You can import and export data from it. You can also manage and search the FHIR resources you have stored in the data store.

  • Deleting – Your data store is being deleted.

  • Deleted – Your data store has been deleted.

Creating a data store (AWS Management Console)

HealthLake console differences

The HealthLake console does not support creating a SMART on FHIR enabled data store. To create a SMART on FHIR enabled data store, you must use the AWS CLI or one of the AWS supported SDKS. To learn more, see Integrating SMART on FHIR with AWS HealthLake. Also, the console does not differentiate between the two types of data stores supported by HealthLake when you view an individual data store's details page.

To create a HealthLake data store
  1. Open the HealthLake console at https://console.aws.amazon.com//healthlake/home.

  2. Open the Navigation pane (≡).

  3. Then, choose Data Stores.

  4. Next, choose Create Data Store.

  5. In the Data Store settings section, for Data Store name specify a name.

  6. (Optional) In the Data Store settings section, for Preload sample data select the check box to preload Synthea data.

  7. In the Data Store encryption section, choose either Use AWS owned key (default) or Choose a different AWS KMS key (advanced).

  8. In the Tags - optional section, you can add tags to your data store.

  9. Next, choose Create Data Store. The status of your data stores are available on the Data stores page.

Creating a data store (AWS CLI and AWS SDKs)

You can use the following code examples to create a HealthLake data store.

AWS CLI

The following example demonstrates using the CreateFHIRDatastore operation with the AWS CLI. To run the example, you must install the AWS CLI. When you create your data store, encryption at rest defaults to an AWS-owned KMS key, unless specified otherwise. To learn more about encryption at REST for HealthLake see, Encryption at REST for AWS HealthLake.

The example is formatted for Unix, Linux, and macOS. For Windows, replace the backslash (\) Unix continuation character at the end of each line with a caret (^).

aws healthlake create-fhir-datastore \ --datastore-type-version R4 \ --preload-data-config PreloadDataType="SYNTHEA" \ --datastore-name "your-data-store-name"

When successful, you get the following JSON response. When your data store is ready to ingest data, the status changes to ACTIVE. To learn more about importing data to your HealthLake data store, see Importing files into a HealthLake data store.

{ "DatastoreId": "eeb8005725ae22b35b4edbdc68cf2dfd", "DatastoreArn": "arn:aws:healthlake:us-west-2:111122223333:datastore/fhir/eeb8005725ae22b35b4edbdc68cf2dfd", "DatastoreStatus": "CREATING", "DatastoreEndpoint": "https://healthlake.us-west-2.amazonaws.com/datastore/eeb8005725ae22b35b4edbdc68cf2dfd/r4/" }

To view a list of all data storesdata stores, you can use the ListFHIRDataStore operation. You can also see a list of Active data stores in the HealthLake console.

Python (boto3)

The following example demonstrates how to create a HealthLake data store using the create_fhir_datastore operation. When you create your data store encryption at rest defaults to an AWS-owned AWS KMS key unless specified otherwise. To learn more about encryption at REST for HealthLake see, Encryption at REST for AWS HealthLake.

import boto3 import logging #built in logging library from botocore.exceptions import ClientError, ValidationError #specific exception ClientError from the boto3 library def create_healthlake_datastore(DatastoreName=None): ''' :param DatastoreName: the name of the data store, string :param: :return: True if the data store is created, else False ''' # Create an Amazon Healthlake data store # Should we say something about region setting? # Should this example have some handling KMS keys try: if DatastoreName is None: healthlake_client = boto3.client('healthlake') healthlake_client.create_fhir_datastore(DatastoreTypeVersion='R4') else: healthlake_client = boto3.client('healthlake') healthlake_client.create_fhir_datastore(DatastoreTypeVersion='R4', DatastoreName=DatastoreName) except (ClientError, ValidationError) as e: logging.error(e) return False return True # Run the function above create_healthlake_datastore(DatastoreName='test-datastore-delete-me-2')

A data store can have one of four statuses. Use list_fhir_datastores to view a list of your HealthLake data stores regardless of status. This example shows how you can filter based on the status of a data store.

import boto3 healthlake_client = boto3.client('healthlake') data_store_list = healthlake_client.list_fhir_datastores(Filter={'DatastoreStatus': 'ACTIVE'}) print(data_store_list)

To learn more, see list_fhir_datastore in the Boto3 Documentation.