CFR § 164.312 COMPLIANT INFRASTRUCTURE

HIPAA-Compliant AWS Infrastructure, Defined as Code

Deploy secure, modular, and battle-tested AWS environments utilizing Terraform blueprints. Engineered specifically to satisfy the HIPAA/HITECH Technical Safeguards with zero manual configuration.

terraform CLI

$

Hardened to Meet CFR § 164.312 Safeguards

Every module in the stack corresponds directly to a technical safeguard mandated by the HIPAA Security Rule.

§ 164.312(a)(1)

Data Isolation & Network Security

Deploy databases (RDS PostgreSQL) and compute workloads (ECS Fargate) solely in isolated private subnets. Enforce zero public routing. Secure external ingress through AWS WAFv2 and AWS Client VPN tunnel interfaces.

§ 164.312(a)(2)(iv)

Encryption Everywhere

Enforce AES-256 Server-Side Encryption (SSE-KMS) backed by a Customer Managed Key (CMK) with automated annual rotation. Reject non-HTTPS traffic on S3 and mandate SSL/TLS on database channels.

§ 164.312(b)

Immutable Auditing & Monitoring

Capture management and S3 data-plane events using AWS CloudTrail. Centralize system activity in KMS-encrypted CloudWatch Log Groups, retaining records for a clinical-audit compliant 365 days.

§ 164.312(c)(1)

Integrity & Disaster Recovery

Protect ePHI from accidental deletion or malicious modification. Enforce S3 Object Versioning alongside automated daily snapshot backups utilizing AWS Backup vaults with custom retention locks.

Hardened AWS Architecture Blueprint

Hover over the components in the interactive network topology diagram to examine their configuration details and regulatory mappings.

AWS Cloud BoundaryIsolated VPC (10.0.0.0/16)Public Subnet (Ingress)AWS WAFv2Exploit ShieldClient VPNSecure IngressPrivate Subnet (Workloads)ECS FargateIsolated ContainersRDS PostgreSQLEncrypted DBAmazon HealthLakeFHIR Clinical StoreAWS KMSKey ManagementAmazon S3Secure BucketsAWS CloudTrailAudit LogsClient Ingress
§ 164.312(a)(1) - Access Control

AWS VPC (Isolated Network)

Provides physical and logical network boundary isolation.

Hardened Security Rules

  • Custom subnets with zero direct public routes
  • VPC Flow Logs enabled for security analysis
  • PrivateLink Endpoints route AWS API traffic internally
Architectural Rule
Zero ePHI is allowed to pass through public channels. All transactions between client compute and persistent stores route through PrivateLink or CMK encryption.
Library catalog

Modular Service Catalog

Explore the 13 modular, production-ready services included in the stack. Click on any module to view its exact technical security controls.

§ 164.312(a)(1) - Access Control

VPC (Virtual Private Cloud)

services/vpc

Logical network isolation for compute workloads and database clusters.

VIEW CONTROLS →
§ 164.312(a)(2)(iv) - Encryption

KMS (Key Management Service)

services/kms

Centralized Customer Managed Keys with automated rotation.

VIEW CONTROLS →
§ 164.312(c)(1) - Data Integrity

Amazon S3 (Simple Storage Service)

services/s3

Secure, versioned, and encrypted patient file storage.

VIEW CONTROLS →
§ 164.312(a)(2)(iv) - Encryption

RDS PostgreSQL (Database)

services/rds

Relational database service in multi-AZ groups with SSL forced.

VIEW CONTROLS →
§ 164.312(a)(2)(iv) - Exchange

Amazon HealthLake (FHIR Store)

services/healthlake

Standardized HL7 FHIR R4 clinical data storage.

VIEW CONTROLS →
§ 164.312(a)(1) - Access Control

ECS Fargate (Container Compute)

services/fargate

Serverless container execution inside isolated subnets.

VIEW CONTROLS →
§ 164.312(a)(1) - Access Control

AWS Client VPN (Secure Access)

services/vpn

Certificate-authenticated VPN tunnels for administrators.

VIEW CONTROLS →
§ 164.312(a)(1) - Access Control

AWS WAFv2 (Web ACL)

services/waf

Web Application Firewall shielding public Load Balancers.

VIEW CONTROLS →
§ 164.312(b) - Audit Controls

AWS CloudTrail (Auditing)

services/cloudtrail

Administrative API and S3 data-plane audit logging.

VIEW CONTROLS →
§ 164.312(b) - Audit Controls

CloudWatch (Encryption Logs)

services/cloudwatch

Centralized, encrypted logs with a 365-day retention policy.

VIEW CONTROLS →
§ 164.312(a)(2)(iv) - Encryption

Secrets Manager (Credentials)

services/secretsmanager

Secure storage and rotation of credentials and API keys.

VIEW CONTROLS →
§ 164.312(b) - Audit Controls

AWS GuardDuty (Threat Intel)

services/guardduty

Intelligent scanning of flow logs and trails for anomalies.

VIEW CONTROLS →
§ 164.312(c)(1) - Data Integrity

AWS Backup (Disaster Recovery)

services/backup

Automated daily backups with custom vault locks.

VIEW CONTROLS →
Code integrations

Compliant Integration Templates

Examine production-ready, security-hardened configurations. Switch between infrastructure blueprints and application logic patterns.

Select Template

CFR Security Citation

§ 164.312(a)(2)(iv) Encryption, § 164.312(c)(1) Integrity, § 164.312(e)(1) Transmission

Configures default KMS-SSE bucket encryption, blocks all public access paths, enforces object versioning, and denies non-HTTPS transport operations.

services/s3/main.tf
1# HIPAA-Compliant S3 Storage Service
2# Aligns with: 164.312(a)(2)(iv) Encryption, 164.312(c)(1) Integrity, 164.312(e)(1) Transmission Security
3
4resource "aws_s3_bucket" "phi" {
5 bucket = var.bucket_name
6 force_destroy = false
7
8 tags = {
9 Environment = var.environment
10 Compliance = "HIPAA"
11 }
12}
13
14resource "aws_s3_bucket_public_access_block" "phi_block" {
15 bucket = aws_s3_bucket.phi.id
16
17 block_public_acls = true
18 block_public_policy = true
19 ignore_public_acls = true
20 restrict_public_buckets = true
21}
22
23resource "aws_s3_bucket_versioning" "phi_versioning" {
24 bucket = aws_s3_bucket.phi.id
25 versioning_configuration {
26 status = "Enabled"
27 }
28}
29
30resource "aws_s3_bucket_server_side_encryption_configuration" "phi_encryption" {
31 bucket = aws_s3_bucket.phi.id
32
33 rule {
34 apply_server_side_encryption_by_default {
35 kms_master_key_id = var.kms_key_arn
36 sse_algorithm = "aws:kms"
37 }
38 bucket_key_enabled = true
39 }
40}
41
42resource "aws_s3_bucket_policy" "phi_policy" {
43 bucket = aws_s3_bucket.phi.id
44
45 policy = jsonencode({
46 Version = "2012-10-17"
47 Statement = [
48 {
49 Sid = "EnforceTLSRequestsOnly"
50 Effect = "Deny"
51 Principal = "*"
52 Action = "s3:*"
53 Resource = [
54 aws_s3_bucket.phi.arn,
55 "${aws_s3_bucket.phi.arn}/*"
56 ]
57 Condition = {
58 Bool = {
59 "aws:SecureTransport" = "false"
60 }
61 }
62 }
63 ]
64 })
65}
Compliance education

Managing the 18 PHI Identifiers

Under the HIPAA Privacy Rule, clinical data combined with any of these 18 identifiers constitutes Protected Health Information (PHI).

The 18 PHI Safeguards

To prevent accidental disclosures in application logs, error payloads, and diagnostic telemetries, these identifiers must be systematically scrubbed or replaced with database-generated UUIDs.

1.Names
2.Geographic subdivisions smaller than a state
3.Dates directly related to an individual
4.Telephone numbers
5.Fax numbers
6.Email addresses
7.Social Security Numbers (SSN)
8.Medical Record Numbers (MRN)
9.Health plan beneficiary numbers
10.Account numbers
11.Certificate/license numbers
12.Vehicle identifiers and serial numbers
13.Device identifiers and serial numbers
14.Web Universal Resource Locators (URLs)
15.Internet Protocol (IP) addresses
16.Biometric identifiers (finger/voice)
17.Full-face photographs
18.Any other unique identifying code/number

Log Scrubber Sandbox

Scrubber engine online