How to Build a HIPAA-Compliant Serverless Architecture (AWS, Azure, GCP)
Business Associate Agreement Management
A HIPAA-Compliant Serverless Architecture starts with a signed Business Associate Agreement (BAA). Without a BAA, you must not create, receive, maintain, or transmit PHI in the cloud. The BAA defines shared responsibility, permitted uses, breach notification timelines, and safeguards you must implement.
Establish the PHI boundary early. Identify which functions, storage locations, queues, and analytics components will touch PHI and which will not. Tag these resources, restrict deployments to HIPAA-Eligible Services, and document data flows from ingestion to archival and deletion.
Practical BAA workflow
- Execute a BAA with AWS, Azure, or GCP for each account, subscription, or project that will process PHI.
- Create a control matrix mapping BAA clauses to technical and administrative safeguards you operate.
- Maintain an inventory of subprocessors and ensure their BAAs and scopes are aligned.
- Define breach response procedures, evidence retention periods, and right-to-audit processes.
- Record architecture decisions (ADRs), data classification, and “minimum necessary” access justifications.
Review the BAA annually and after material changes. Confirm that all services used for PHI remain eligible and that your configurations continue to meet the agreement’s requirements.
Selecting HIPAA-Eligible Serverless Services
Choose building blocks that appear on your provider’s HIPAA-Eligible Services list and are covered by your BAA. Validate eligibility at the service, feature, and region level before any PHI touches the system. When in doubt, isolate PHI to a smaller, verified subset of services.
Compute and APIs
For event-driven compute, you can use managed functions and APIs: AWS Lambda with Amazon API Gateway, Azure Functions with Azure API Management, or Google Cloud Functions and Cloud Run with API Gateway. Confirm runtime versions, integrations, and regions are permitted for PHI under your agreement.
Messaging and orchestration
Event distribution and workflow are core to serverless designs. Common choices include Amazon SNS and SQS with AWS Step Functions, Azure Event Grid and Service Bus, and Google Cloud Pub/Sub with Workflows. Ensure message persistence, dead-letter queues, and retry behaviors meet your compliance and durability needs.
Storage and data
Object stores and managed databases must support encryption and access controls suitable for PHI. Typical options include Amazon S3 and DynamoDB, Azure Blob Storage and Cosmos DB, and Google Cloud Storage and Firestore. Apply immutable retention or object lock where policy requires write-once, read-many (WORM) controls.
Security, keys, and secrets
Use native key and secret services: AWS KMS and Secrets Manager, Azure Key Vault, and Google Cloud KMS and Secret Manager. These enable centralized Encryption Key Management, fine-grained access controls, and auditable key usage tied to your Identity and Access Management model.
Selection checklist
- Verify the service and region are HIPAA-eligible under your BAA.
- Confirm encryption in transit and at rest, plus customer-managed key support.
- Enable detailed logs and integrate with central monitoring and alerting.
- Restrict public access; prefer private networking and controlled egress.
- Document data residency, backup, and deletion behaviors.
Implementing Data Encryption Strategies
Encryption protects PHI confidentiality and limits blast radius during incidents. Implement defense in depth: transport encryption, storage encryption, and application-layer controls designed for Serverless Function Security.
Transport encryption
Enforce TLS 1.2+ for all inbound and outbound connections. Terminate TLS at managed API edges, and require TLS for service-to-service calls. For internal services, consider mutual TLS to authenticate both client and server and to reduce reliance on network trust.
Encryption at rest
Enable server-side encryption everywhere PHI lands, including logs, queues, and backups. Prefer customer-managed keys (CMKs) in KMS or Key Vault so you control rotation, disabling, and deletion. Ensure temporary storage used by functions is encrypted and that artifacts never contain PHI in plaintext.
Application-layer controls
Apply envelope encryption for sensitive fields before writing to storage. Use tokenization or format-preserving encryption where you must search or sort on protected values. Keep cryptographic materials out of code and environment variables; retrieve short-lived data keys from a secure secret store at runtime.
Encryption Key Management practices
- Isolate keys by environment, application, and, when applicable, tenant.
- Rotate keys on a defined schedule and on-demand after personnel or scope changes.
- Separate duties: key administrators differ from data owners and function developers.
- Restrict decrypt permissions to the minimum set of principals and functions.
- Audit key usage and alert on unusual decryption patterns.
Enforcing Access Control Policies
Design Identity and Access Management (IAM) around least privilege and the “minimum necessary” standard. Every function, pipeline, and human must have only the permissions required to perform its role, for the shortest practical duration.
Per-function least privilege
Assign a unique identity (role or service account) to each function. Scope permissions to specific resources and actions, and use attribute-based conditions (environment, tags, source VPC) to narrow access. Avoid wildcard actions and organization-wide roles for routine tasks.
API authentication and authorization
Protect APIs with a strong identity layer such as OAuth 2.0/OIDC with JWTs. Validate scopes and claims inside functions, and apply resource-level authorization checks. Use custom authorizers or policies to enforce tenant isolation and to block cross-tenant data access.
Secrets and credentials
Store credentials in a managed secret service, not in code, layers, or plaintext environment variables. Grant read access only to the functions that need them and rotate frequently. Prefer short-lived credentials obtained at invocation time over long-lived static keys.
Administrative access
Require MFA for console access, implement just-in-time elevation with approvals, and keep “break-glass” roles tightly controlled and monitored. Review access quarterly, revoke unused roles, and record all administrative actions for Audit Logging and for incident response readiness.
Ready to simplify HIPAA compliance?
Join thousands of organizations that trust Accountable to manage their compliance needs.
Configuring Audit Logging and Monitoring
Comprehensive logging proves control effectiveness and enables rapid detection. Capture who did what, when, from where, and to which PHI-bearing resource. Centralize logs, secure them from tampering, and build actionable alerts.
What to log
- Administrative changes to IAM, networking, encryption, and function configurations.
- Data access events for storage, databases, keys, and secrets.
- Function invocation telemetry, execution errors, and retries.
- Network flows, API access logs, WAF decisions, and egress destinations.
- Security findings from managed detectors and vulnerability scans.
Provider logging
Enable and centralize management-plane and data-plane logs: for example, AWS CloudTrail and service logs, Azure Activity Log and Monitor, and Google Cloud Audit Logs and Cloud Logging. Ensure logs for HIPAA-Eligible Services are retained per policy and are sent to a dedicated, write-only logging destination.
Integrity and retention
Protect logs using immutable storage, legal holds where required, and strict access controls. Hash or sign critical logs to detect tampering. Standardize timestamps and correlation IDs so you can trace a user action through APIs, functions, messaging, and storage.
Alerting and response
Create rules for anomalous behavior: mass decrypts, policy changes on sensitive resources, spikes in data egress, or unexpected public access. Route alerts to an on-call rotation with playbooks that define triage, containment, evidence preservation, and notification steps.
Securing Network Architecture
Even in serverless, network controls matter. Place PHI workloads inside a Virtual Private Cloud and keep traffic on private backbones wherever possible. Limit exposure at the edge and control egress to reduce exfiltration risk.
Private connectivity
Connect functions to private subnets and use private endpoints to reach storage, databases, and managed services without traversing the public internet. Apply network ACLs and security groups to restrict lateral movement and require outbound traffic to pass through controlled egress points.
Edge protection
Front APIs with managed DDoS protection and a web application firewall. Enforce HTTPS, strict TLS policies, request validation, and rate limiting. Use bot controls and threat intelligence where appropriate to protect public endpoints and reduce noise before it hits your functions.
Egress controls
Route outbound traffic through NAT or proxies that enforce domain allowlists. Block unauthorized destinations, log DNS queries, and alert on unusual data volumes. Consider data loss prevention controls for high-risk paths.
Isolation and segmentation
Separate production, staging, and development into distinct accounts, subscriptions, or projects. For multi-tenant systems, isolate tenants by design—logical segregation in code plus per-tenant roles, policies, and, where feasible, per-tenant keys and storage partitions.
Documenting Compliance Procedures
Clear documentation turns good engineering into demonstrable compliance. Auditors will ask how you control access, encrypt data, monitor activity, and respond to incidents—then request evidence that your procedures work in practice.
Policies and SOPs
- Access control and Identity and Access Management standards, including provisioning and reviews.
- Encryption, key rotation, and key recovery procedures aligned to Encryption Key Management policies.
- Audit Logging configuration, retention schedules, and log integrity validation steps.
- Incident response runbooks, breach notification workflows, and communication plans.
- Data lifecycle: collection, minimization, retention, archival, and secure deletion.
Evidence and change management
Capture IaC templates, configuration baselines, and screenshots that show controls in effect. Track approvals for changes that affect PHI, maintain code review records, and keep a register of exceptions with compensating controls and expiry dates.
Testing and assurance
Run tabletop exercises, restore-from-backup tests, and periodic access reviews. Validate that logs land in immutable storage, alarms reach responders, and deprovisioning removes all access. Document findings and remediation to close the loop.
Bringing it all together: start with a solid BAA, pick HIPAA-Eligible Services, encrypt everywhere, enforce least privilege, log and monitor comprehensively, secure networking, and prove it with documentation. With these practices, you can operate an event-driven platform on AWS, Azure, or GCP while protecting PHI and meeting HIPAA obligations.
FAQs
What is a Business Associate Agreement for HIPAA compliance?
A Business Associate Agreement is a contract required by HIPAA between a covered entity or business associate and its cloud provider or vendor. It allocates responsibilities for safeguarding PHI, defines permitted uses, sets breach notification timelines, and enables you to use the provider’s services for PHI under specified conditions.
How do I ensure encryption of PHI in serverless environments?
Enforce TLS 1.2+ for all traffic, enable server-side encryption for every storage and messaging service, and use customer-managed keys in KMS or Key Vault. Apply envelope encryption or tokenization for sensitive fields, restrict decrypt permissions to specific functions, and log all key usage for monitoring and audits.
Which serverless services are HIPAA-eligible on AWS, Azure, and GCP?
Eligibility varies by provider, service, feature, and region. Common serverless building blocks used in HIPAA programs include functions and APIs (AWS Lambda, Azure Functions, Google Cloud Functions/Cloud Run), messaging and orchestration (SNS/SQS with Step Functions, Event Grid/Service Bus, Pub/Sub), and storage/databases (S3, Blob Storage, Cloud Storage; DynamoDB, Cosmos DB, Firestore). Always verify current eligibility under your BAA before processing PHI.
What audit logging is required for HIPAA compliance?
You should log administrative actions, data access events, and security-relevant activity across APIs, functions, storage, messaging, keys, and networking. Centralize logs, protect them from tampering with immutable storage, retain them per policy, and configure alerts for anomalies such as mass decrypts, policy changes, or unusual egress.
Ready to simplify HIPAA compliance?
Join thousands of organizations that trust Accountable to manage their compliance needs.