Setting Up an AWS HIPAA-Compliant Infrastructure

A practitioner's guide to architecting AWS environments for HIPAA compliance, covering everything from BAA agreements to robust log retention.

“HIPAA compliance isn’t just about passing an audit; it’s about building a baseline of security that protects patient data from the ground up.”

The Foundation of HIPAA in AWS

Building a HIPAA-compliant infrastructure on AWS requires a defense-in-depth approach. It touches every layer of your cloud architecture, from account structure to network routing and access management. Here is how you establish a secure, compliant baseline.

BAA Signed with AWS

Why: AWS operates under a shared responsibility model. While AWS secures the physical data centers, you are responsible for how you configure the services running on top of them. To process Protected Health Information (PHI) legally on AWS, you must have a Business Associate Addendum (BAA) in place. This legally binds AWS to safeguard the physical infrastructure where your PHI resides and establishes the compliance baseline for the services you consume. Without a signed BAA, storing a single byte of PHI on AWS is a HIPAA violation.

How: Log into your AWS root account, navigate to AWS Artifact, review the AWS BAA, and accept the agreement for your entire organization. Ensure that you only use HIPAA-eligible AWS services for workloads that process or store PHI (AWS maintains a public list of these services).

Account Separation

Why: Blast radius reduction is critical in cloud security. If a developer’s sandbox is compromised, or a staging database is accidentally exposed, the attacker should have absolutely zero access to production PHI or your immutable audit logs. Relying on VPC separation within a single account is an anti-pattern; AWS accounts are the only true hard boundary for identity and billing isolation.

How: Use AWS Organizations to create a multi-account strategy using AWS Control Tower. Provision dedicated accounts for Prod, Staging, Dev, Security, and Logs. Route all billing to a management account and ensure no workloads or infrastructure run there. Use AWS Resource Access Manager (RAM) to share necessary foundational infrastructure (like Transit Gateways) across accounts securely.

SCPs Guardrails

Why: Service Control Policies (SCPs) prevent misconfigurations before they happen. They act as absolute barriers that even administrators with full AdministratorAccess cannot override, stopping common mistakes like making S3 buckets public or disabling essential logging. Preventive controls are always better than reactive alerts.

How: Apply SCPs at the AWS Organizations root or Organizational Unit (OU) level. Enforce policies that block s3:PutBucketPublicAccessBlock across the board, deny the ability to stop or delete CloudTrail trails, restrict resource creation to approved geographic regions (e.g., only us-east-1 and us-west-2), and prevent the deletion of critical KMS keys.

Data Protection and Encryption

KMS CMK on All Storage

Why: HIPAA requires encryption at rest. While AWS-managed keys (like aws/s3) provide basic encryption, using Customer Managed Keys (CMKs) gives you granular cryptographic control. More importantly, CMKs provide an explicit audit trail in CloudTrail showing exactly when, why, and by whom a key was used to decrypt PHI. This auditability is invaluable during an incident investigation.

How: Provision KMS CMKs within a dedicated Security or Shared Services account. Enable automatic annual key rotation to meet cryptographic best practices. Enforce their use via IAM policies and SCPs across all S3 buckets, EBS volumes, RDS instances, and DynamoDB tables holding PHI.

TLS 1.2+ Everywhere

Why: Encryption in transit is a strict mandate for PHI. Older TLS versions (like TLS 1.0 or 1.1) have known cryptographic vulnerabilities and are non-compliant. Furthermore, unencrypted HTTP traffic poses a severe interception risk and constitutes an immediate compliance failure.

How: Configure AWS Application Load Balancers (ALB), API Gateways, and CloudFront distributions to explicitly drop HTTP traffic or redirect it immediately to HTTPS. Enforce minimum TLS 1.2 (or preferably TLS 1.3) in your SSL/TLS security policies. Terminate TLS as close to the workload as possible.

VPC Endpoints

Why: By default, traffic to native AWS services (like S3, DynamoDB, or Secrets Manager) traverses the public internet, even if the source is a private subnet. VPC Endpoints keep this traffic entirely within the AWS global backbone network, significantly reducing exposure to internet-based interception or routing attacks.

How: Create Interface VPC Endpoints (AWS PrivateLink) or Gateway VPC Endpoints for the AWS services your workloads consume. Attach restrictive endpoint policies that only allow access to your specific organization’s resources (e.g., only allowing S3 traffic to buckets owned by your AWS account ID).

Identity and Access Management

IAM Roles and MFA

Why: Long-term access keys are a massive liability—they get leaked in source code, exposed in CI/CD logs, and forgotten on developer laptops. Relying strictly on temporary roles ensures that credentials are short-lived and automatically rotated, heavily mitigating the risk of credential compromise. Multi-Factor Authentication (MFA) provides a necessary second layer of defense for human access.

How: Ban the creation of IAM Users with static access keys entirely. Require federated Single Sign-On (SSO) using Okta, Azure AD, or AWS IAM Identity Center. Enforce MFA for all human access sessions and strictly limit session durations to 8 or 12 hours.

EKS Pod Identities

Why: If you run Kubernetes workloads, you need fine-grained access control at the pod level. Amazon EKS Pod Identity ensures that a specific pod only receives the exact permissions it needs to function, rather than inheriting the broad permissions of the underlying EC2 node profile. It is the modern, streamlined alternative to the older IRSA (IAM Roles for Service Accounts) model, reducing configuration overhead and eliminating the need to manage complex OIDC federations manually.

How: Install the EKS Pod Identity Agent add-on to your cluster. Create AWS IAM roles configured to trust the pods.eks.amazonaws.com service principal, and map these roles directly to your specific Kubernetes service accounts and namespaces using the EKS API or console.

Secrets Manager

Why: Hardcoding credentials, API keys, or database passwords in source code or plaintext configuration files is a critical security failure and a direct violation of access control mandates. Credentials must be stored securely, strictly audited upon access, and rotated frequently to limit exposure.

How: Store all sensitive strings, database credentials, and third-party API tokens in AWS Secrets Manager. Grant workloads access only to the specific secrets they need via IAM policies. Configure AWS Lambda functions to handle automatic credential rotation for supported databases like RDS PostgreSQL or MySQL.

Logging and Detection

Comprehensive CloudTrail Logging

Why: In the event of a breach, you must prove exactly what was accessed, by whom, and when. Without extensive audit logs, incident response is impossible, and regulators will assume the worst regarding data exposure. You cannot investigate what you cannot see. Comprehensive logs protect you from regulatory fines and help scope the actual impact of a compromise.

How: Enable CloudTrail globally across all AWS regions, even those you don’t actively operate in (to catch unauthorized infrastructure spin-ups). Configure it to capture both Management events and Data events, especially for S3 buckets or DynamoDB tables holding PHI.

Crucially, route these logs to a dedicated, heavily restricted “Logs” AWS account. Protect the destination S3 bucket with MFA Delete, strict bucket policies, and S3 Object Lock (WORM compliance) to guarantee immutability. Finally, retain these logs for a minimum of 6 years to satisfy HIPAA’s strict data retention and auditability requirements.

VPC Flow Logs and CloudWatch

Why: Network visibility is key to detecting lateral movement, compromised instances, or unauthorized data exfiltration. If an attacker bypasses application controls and tries to ship PHI out of your VPC to an external IP, VPC flow logs provide the forensic evidence needed to detect and investigate the anomaly.

How: Enable VPC Flow Logs on all critical subnets and Transit Gateways. Route the logs to CloudWatch Logs for immediate querying or stream them to a centralized S3 bucket in your Logs account. Ensure the destination storage is encrypted with your KMS CMKs.

Native Security Tooling

Why: You need continuous monitoring for threats, misconfigurations, and vulnerabilities across your sprawling infrastructure. Relying on point-in-time annual audits leaves you completely blind between assessment cycles. Continuous compliance is the only way to operate securely at cloud scale.

How: Enable Amazon GuardDuty for intelligent threat detection and anomaly monitoring. Turn on AWS Security Hub to aggregate findings and measure your compliance posture against the CIS AWS Foundations Benchmark. Use Amazon Macie for automated discovery and monitoring of PHI stored in S3, and AWS Inspector for continuous vulnerability scanning of EC2 instances and container images. Enable AWS Config to track resource changes over time.

Operations and Resilience

CVE SLAs in CI/CD

Why: Unpatched software and outdated dependencies are the easiest and most common way into your environment. HIPAA requires you to proactively protect against known vulnerabilities. Security cannot just be an operations problem; it must be shifted left into the development lifecycle.

How: Integrate container and dependency vulnerability scanning (using tools like Trivy or AWS Inspector) directly into your CI/CD pipelines. Block deployments automatically if critical or high CVEs are found. Enforce a strict Service Level Agreement (SLA) for patching—for example, critical vulnerabilities must be patched within 48 hours, and highs within 14 days.

Cross-Region Backups

Why: Ransomware attacks, malicious insiders, or a total AWS region failure could wipe out your primary data stores. HIPAA’s Security Rule mandates contingencies to guarantee the availability and integrity of electronic PHI.

How: Configure AWS Backup plans to take automated snapshots of RDS, EBS, and DynamoDB. Replicate these backups securely to a secondary, isolated AWS region (and ideally to a separate AWS account). Perform and document a full restore drill at least quarterly to prove your Recovery Time Objective (RTO) and Recovery Point Objective (RPO) can be met.

Incident Response Runbooks

Why: When a high-severity alert fires, your team needs a predefined, tested plan of action. Hesitation, confusion, or ad-hoc decision-making during an active breach significantly increases the scope of the damage and data loss.

How: Document step-by-step Standard Operating Procedures (SOPs) for common scenarios: isolating compromised EC2 instances, rotating exposed IAM keys, failing over databases, and declaring a formal security incident. Store these playbooks outside of your primary AWS environment (e.g., in a separate SaaS wiki) so they are accessible even if your AWS access is fully compromised.

HIPAA Infrastructure Checklist

CategoryRequirementKey Action
FoundationBAA AgreementAccept the AWS Business Associate Addendum via AWS Artifact.
FoundationAccount StructureUse AWS Organizations for strict Prod/Dev/Security/Log isolation.
FoundationGuardrailsDeploy SCPs to block public S3 buckets and enforce regions.
Data ProtectionAt-Rest EncryptionMandate KMS CMKs for all S3, EBS, and RDS resources holding PHI.
Data ProtectionIn-Transit EncryptionEnforce TLS 1.2+ on all ALBs/API Gateways and block HTTP.
Data ProtectionNetwork IsolationRoute AWS service traffic through private VPC Endpoints.
IdentityAccess KeysBan long-lived IAM Users; enforce SSO, roles, and mandatory MFA.
IdentityWorkload AccessImplement EKS Pod Identities for fine-grained pod permissions.
IdentitySecret ManagementStore and auto-rotate database and API keys in Secrets Manager.
LoggingAudit TrailsEnable multi-region CloudTrail (Management + Data events).
LoggingNetwork VisibilityTurn on VPC Flow Logs for all subnets and centralize to S3/CloudWatch.
LoggingRetention & IntegrityStore logs in a dedicated account with S3 Object Lock for 6 years.
DetectionContinuous MonitoringEnable GuardDuty, Security Hub, Macie, Config, and Inspector.
OperationsVulnerability MgmtBlock CI/CD deployments for critical CVEs and define patch SLAs.
OperationsDisaster RecoveryAutomate cross-region backups and test restores quarterly.
OperationsIncident ResponseMaintain external runbooks for containment and eradication.

Final Thought

Achieving HIPAA compliance on AWS is not a one-time checkbox exercise; it requires a continuous commitment to security fundamentals. By enforcing strong isolation, encrypting data at every stage, and maintaining immutable audit trails, you build an environment that protects patient data automatically.

Xpernix can help you secure and monitor your infrastructure. Reach out in your dedicated channel or book a discovery call if you want help reviewing your AWS compliance posture.