# Create a destination for AWS + HealthLake

To populate your <u>**Amazon Web Services**</u> (<u>**AWS**</u>) repository with healthcare data from an EHR system via Redox (and then to analyze and normalize that data in FHIR format with <u>**AWS HealthLake**</u>), you must configure a specific <u>Redox cloud destination</u>. A Redox <u>destination</u> represents where a message is delivered (e.g., like the address in the “To” line of an email header). [Learn more about connecting Redox to your cloud repository](/basics/connecting-to-the-cloud-with-redox).

You’ll need to perform some steps in your cloud product(s) and some in Redox. You can perform Redox setup in our dashboard or with the Redox Platform API. 

## Prerequisites

- Establish a connection with your preferred EHR system. [Learn how to request a connection](/how-to-use-redox/manage-your-redox-setup/request-a-connection-or-subscription).
- Complete your <u>**AWS**</u> and <u>**AWS HealthLake**</u> configuration _before_ creating your Redox destination. Save any downloads with secret values, since you’ll need to enter some of these details into the Redox dashboard.
- Grant access to Redox from AWS (and any other cloud product) to authorize Redox to push data to your cloud repository.

## Configure in AWS

1. Navigate to the AWS dashboard and log in. 
2. [Create an IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html). 
3. [Generate an access key](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) and secret pair.
4. Create a new HealthLake datastore, or open an existing one.   

## Create a cloud destination in Redox

Next, create a <u>cloud destination</u> in your Redox organization. When the EHR system sends healthcare data to Redox, we push it on to your configured AWS + HealthLake cloud destination.

### In the dashboard

1. For the select destination step, [follow the instructions for creating a cloud destination](https://docs.redoxengine.com/permalink/5FMTxkOE7yrDCBgiqfV3Z7/#create-a-destination). 
2. From the <u>**Product type**</u> field, select **HealthLake**.
3. For the configure destination step, populate these fields. Then click the **Next** button. 
   1. <u>**FHIR URL**</u>: Enter the AWS FHIR endpoint where data should be sent.
4. For the auth credential step, either a drop-down list of existing auth credentials displays or a new auth credential form opens. [Learn how to create an auth credential ](https://docs.redoxengine.com/how-to-use-redox/manage-your-redox-setup/set-up-auth-credentials/#aws-signature-version-4)for AWS Sigv4.  


> **Existing or new auth credential**
>
> Your existing auth credentials will only display if they’re supported for the cloud product type you selected. If you don’t have any supported auth credentials for the cloud type in the current Redox environment, you’ll have to create a new auth credential.


5. For the verify step, [follow the instructions for verifying a destination](https://docs.redoxengine.com/permalink/5FMTxkOE7yrDCBgiqfV3Z7/#step-4-verify-destination). 

### With the Redox Platform API

1. [Review the Create auth credential endpoint](https://docs.redoxengine.com/permalink/dd0240f7-18d1-593d-87a7-d81bf86f543c-create-auth-cred).
2. In your terminal, prepare the `/v1/authcredentials` request.
3. Specify these values in the request. 
   - Locate the `accessKey` and `secretKey` values in the AWS dashboard. 


**Example: Create auth credential for AWS + HealthLake**

```json
curl 'https://api.redoxengine.com/platform/v1/authcredentials' \
--request POST \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
    "organization": "<Redox_organization_id>",
    "name": "<human_readable_name_for_auth_credential>",
    "environmentId": "<Redox_environment_ID>",
    "authStrategy": "AwsSigV4",
    "accessKey": "<access_key_from_AWS>",
    "secretKey": "<secret_key_from_AWS>",
    "serviceName": "healthlake",
    "awsRegion": "<aws_region_of_healthlake_datastore>"
  }
```


4. You should get a successful `200` response and a `payload` populated with the details of the new auth credential. 
5. [Review the Create destination endpoint](https://docs.redoxengine.com/permalink/96830826-bf9c-5d5a-878c-b5b3f1402f30-create-destination).
6. In your terminal, prepare the `/v1/environments/{environmentId}/destinations` request with these values: 
   - Set `authCredential` to the auth credential ID from the response you received in step #4.  
   - Populate `cloudProviderSettings` with the settings below.  
     - Locate the FHIR base URL in the AWS dashboard.


**Example: Values for AWS + HealthLake cloudProviderSettings**

```json
{
  "cloudProviderSettings": {
    "typeId": "aws",
    "productId": "healthlake", 
    "settings": {
      "fhirBaseUrl": "<URL_of_healthlake_datastore>",
     }
  }
}
```


7. You should get a successful `200` response with a `payload` populated with the details of the new AWS cloud destination. Specifically, the `verified` status of the destination should be set to `true`. 
8. Your new destination will now be able to receive messages. Redox converts any notification bundles or other message bundles into individual FHIR resource requests. This ensures compatibility with HealthLake's ingestion requirements. Then, the FHIR data is stored in the HealthLake datastore. 
