Deleting Resource Types with $bulk-delete - AWS HealthLake

Deleting Resource Types with $bulk-delete

AWS HealthLake supports the $bulk-delete operation, enabling deletion of all resources of a specific type within a datastore. This operation is particularly useful when you need to:

  • Perform seasonal auditing and clean-up

  • Manage data lifecycle at scale

  • Remove specific resource types

  • Comply with data retention policies

Usage

The $bulk-delete operation can be invoked using POST methods:

POST [base]/[ResourceType]/$bulk-delete?hardDelete=false&deleteVersionHistory=false&deleteAuditEvent=true

Parameters

Parameter Type Required Default Description
isHardDelete boolean No false When true, permanently removes resources from storage
deleteVersionHistory boolean No false if isHardDelete is false, true if isHardDelete is true When true, deletes all historical versions, must be used with hardDelete = true or ignored
deleteAuditEvent boolean No true When true, deletes associated audit events
_since string No Datastore creation time When entered, selects the starting cutoff time to find resources based on their lastModified time. Cannot be used with start or end
start string No Datastore creation time When entered, selects the cutoff time to find resources based on their lastModified time. Can be used with end
end string No Job submission time When entered, selects the ending cutoff time to find resources based on their lastModified time

Examples

Example Request

POST [base]/Observation/$bulk-delete?hardDelete=true
Example Response

{ "resourceType": "OperationOutcome", "id": "bulk-delete-job", "issue": [ { "severity": "information", "code": "informational", "diagnostics": "Bulk delete job started successfully. Job ID: 12345678-1234-1234-1234-123456789012" } ] }

Job Status

To check the status of a bulk delete job:

GET [base]/$bulk-delete/[jobId]

The operation returns job status information:

{ "resourceType": "Parameters", "parameter": [ { "name": "jobId", "valueString": "12345678-1234-1234-1234-123456789012" }, { "name": "jobStatus", "valueString": "COMPLETED" }, { "name": "totalResourcesDeleted", "valueInteger": 1256 }, { "name": "startTime", "valueInstant": "2023-06-15T10:00:00Z" }, { "name": "endTime", "valueInstant": "2023-06-15T10:05:23Z" } ] }

Behavior

The $bulk-delete operation:

  1. Processes asynchronously to handle large volumes of resources

  2. Maintains ACID transactions for data integrity

  3. Provides job status tracking with resource deletion counts

  4. Supports both soft and hard deletion modes

  5. Includes comprehensive audit logging of deletion activities

  6. Allows for selective deletion of historical versions and audit events

Audit Logging

The $bulk-delete operation logs as StartFHIRBulkDeleteJob and DescribeFHIRBulkDeleteJob with detailed operation information.

Limitations

  • Hard-deleted resources will not appear in search responses

  • Resources being deleted through this operation may be temporarily inaccessible during processing

  • Storage metering is adjusted on historical versions only - deleteVersionHistory=false will not adjust datastore storage