Teams building on AWS, Azure, or GCP for healthcare, finance, or other regulated sectors face a common trap: they treat compliance as a paperwork exercise bolted on after the architecture is done. In practice, the controls that satisfy auditors and, more importantly, actually reduce risk, have to be built into the account structure, the network, and the deployment pipeline from day one. This article walks through the engineering practices that matter most, without pretending that any architecture pattern by itself grants you a certification. Compliance frameworks are assessed by auditors against evidence; engineering can only give you the underlying controls and the evidence trail.
Start with account and landing zone separation
A single AWS account or Azure subscription holding dev, staging, and production workloads is one of the most common root causes of both security incidents and failed audits. The fix is a landing zone: a hierarchy of accounts or subscriptions with a designated organization management account, dedicated accounts per environment and per workload boundary, and centralized guardrails applied at the organization level rather than per-resource.
- Separate accounts for production, non-production, shared services (logging, security tooling), and sandbox experimentation.
- A dedicated log-archive account with write-once policies so operators in workload accounts cannot delete or tamper with audit trails.
- Service control policies (AWS) or Azure Policy assignments at the organization/management-group level to enforce guardrails that individual teams cannot override.
- A break-glass access path that is itself logged and alerts on use.
This separation matters because it turns 'who can touch production data' into an account-boundary question enforced by the cloud provider's IAM plane, rather than a convention that depends on every engineer following internal policy correctly.
Data residency and data classification
Before deciding where data lives, classify it. Not all data in a regulated workload carries the same sensitivity, and treating everything as equally sensitive tends to produce systems that are both more expensive and, paradoxically, less carefully controlled where it actually matters.
Practical steps
- 1.Tag data stores and pipelines by classification (e.g., regulated/PII, internal, public) at creation time, not retroactively.
- 2.Pin storage and processing regions explicitly in infrastructure-as-code; do not rely on default regions, which can silently change with new resource types or provider defaults.
- 3.Track data lineage for regulated fields end-to-end: ingestion, transformation, caches, logs, and backups. Backups and logs are the most commonly missed residency violation.
- 4.If you use managed AI or analytics services, confirm in writing which region processes the request and whether prompts/outputs are retained by the vendor for model improvement.
Encryption and key management
Encryption at rest and in transit is table stakes; the engineering decisions that matter are around key ownership and rotation. Using provider-managed keys is simpler operationally, but customer-managed keys (CMKs) give you an audit trail of exactly which principal used a key to decrypt what, and let you revoke access to a dataset by disabling a key rather than chasing down every place a credential might be cached.
- Use customer-managed keys for regulated data stores; scope key policies narrowly (specific roles, specific services) rather than granting broad kms:Decrypt to entire accounts.
- Enable automatic key rotation and alert on manual key policy changes.
- Separate keys per environment and, where feasible, per tenant, so a compromised key has bounded blast radius.
- Enforce TLS 1.2+ for all internal and external service-to-service traffic, including intra-VPC calls between microservices — 'it's inside the VPC' is not a compliance argument.
IAM least privilege, in practice
Least privilege is easy to state and hard to operate. The practical failure mode is IAM policies that start narrow and accumulate wildcard permissions over months as engineers hit permission errors and reach for the fastest fix under deadline pressure. Two practices counter this:
- Generate IAM policies from actual usage (access advisor / IAM Access Analyzer style tooling) on a recurring cadence, and prune unused permissions rather than only adding new ones.
- Use short-lived credentials (federated roles, workload identity) instead of long-lived access keys wherever the platform supports it, and treat any remaining long-lived key as a finding requiring justification.
Human access to production data deserves separate treatment from service-to-service access: require just-in-time elevation with a ticket or approval reference, time-bound sessions, and session logging, rather than standing administrator roles.
Network isolation
Regulated workloads generally require, at minimum: private subnets for data stores and application tiers with no direct internet route, a controlled egress path (NAT gateway or explicit proxy) so outbound traffic can be inspected and restricted, and security groups or NSGs scoped to specific ports and source security groups rather than open CIDR ranges. Where third-party connectivity is required (partner APIs, on-prem interconnect), prefer private connectivity (VPC peering, PrivateLink/Private Endpoint, or a dedicated interconnect) over routing sensitive traffic across the public internet, even when encrypted.
A well-isolated network does not replace encryption or IAM controls — it reduces the number of paths an attacker or a misconfiguration can use, buying time for detection and response.
Audit logging and evidence collection
Auditors and, more usefully, incident responders need answers to: who did what, when, to which resource, and was it approved. That means logging has to be designed, not assumed.
- Enable cloud provider control-plane logging (CloudTrail, Azure Activity Log, GCP Audit Logs) organization-wide, shipped to the log-archive account before anyone can disable it in a workload account.
- Log data-plane access to regulated data stores (object storage access logs, database audit logging) — control-plane logs alone will not show that someone queried a table.
- Retain logs for the period your regulatory framework requires, and test restoration/searchability of archived logs, not just their existence.
- Automate evidence collection for recurring controls (e.g., periodic export of IAM policies, encryption status, patch levels) so audit season is a report generation exercise, not an emergency screenshot campaign.
Change control as code
Manual console changes are the enemy of both security and auditability: they are hard to review, easy to forget, and leave inconsistent evidence. Treat infrastructure as code (Terraform, CloudFormation, Bicep) as the only sanctioned path to production infrastructure changes, with pull-request review, policy-as-code checks (e.g., Open Policy Agent / Sentinel rules that block public S3 buckets or unencrypted volumes before merge), and a plan/apply pipeline that logs who approved what change and when. This gives you, essentially for free, the change-management evidence that regulated frameworks ask for.
Where HIPAA and SOC 2 intersect with engineering
HIPAA's Security Rule and SOC 2's Trust Services Criteria both care about access control, encryption, audit trails, and change management — the practices above address the engineering substance behind both. It is worth being precise here: implementing these controls does not by itself make a system HIPAA compliant or SOC 2 certified. Compliance status depends on legal agreements (such as a signed Business Associate Agreement with your cloud provider and any subprocessors), organizational policies, employee training, and a formal audit by a qualified third party. Engineering teams should build the technical controls and the evidence trail, and work with compliance counsel or an auditor to determine what else is required.
Common mistakes
- Assuming a cloud provider's own compliance attestations transfer automatically to workloads built on top of their infrastructure — the shared responsibility model still leaves most application-layer controls to you.
- Treating encryption as binary ('we encrypt everything') without tracking key ownership or rotation.
- Logging control-plane events but not data-plane access, then discovering the gap during an incident.
- Letting IAM policies grow permissive over time with no periodic review.
- Managing infrastructure partly through console clicks 'just this once', breaking the audit trail.
- Deferring data residency decisions until after a managed AI or SaaS integration is already in production.
Checklist
- Landing zone with environment and workload account separation, plus a dedicated log-archive account.
- Data classified and residency pinned explicitly in infrastructure code.
- Customer-managed encryption keys with rotation and scoped key policies.
- Short-lived credentials for services; just-in-time elevation for human production access.
- Private subnets, controlled egress, and private connectivity for third-party integrations.
- Control-plane and data-plane logging shipped to an isolated, tamper-resistant destination.
- All infrastructure changes via reviewed, policy-checked pipelines — no console changes to production.
- Recurring, automated evidence collection rather than manual audit-season scrambles.
None of these practices are exotic; the difficulty is consistency and discipline over time, especially as teams and workloads grow. Building the controls into the platform and the pipeline, rather than relying on individual engineers to remember them, is what makes regulated workloads both safer and easier to operate.
