SOC 2 and HIPAA controls you can prove with Terraform, not screenshots
A large share of SOC 2 and HIPAA technical controls are infrastructure configuration. Implement them once in Terraform, check them continuously, export the evidence by script, and buy a compliance platform only for the people workflows.

Praveen Kumar
Founder & Technology Leader

On this page
The enterprise deal is waiting on a SOC 2 report. The health-tech customer wants to know how you meet the HIPAA Security Rule. Someone opens a spreadsheet of controls, and a quarterly ritual begins in which engineers take screenshots of the AWS console to prove that logging is on, encryption is enabled and backups exist. The compliance platform's quote arrives before anyone has worked out which of those controls are actually infrastructure.
Having built systems inside a bank and a life-sciences technology company, and having taken smaller companies through their first audits since, my position is this. A large share of the SOC 2 Common Criteria and most of the HIPAA technical safeguards are infrastructure configuration. Infrastructure configuration is code. Implement those controls once in Terraform, let AWS check them continuously, export the evidence with a script, and spend the platform budget on the parts that are genuinely about people: policies, onboarding, vendor reviews, risk assessment.
Everything in this article is in a Terraform module you can apply, with a crosswalk from each control to the resource that implements it and the command that proves it. This is an engineering baseline, not legal advice; your auditor decides scope.
Which controls are infrastructure
SOC 2 is organised around the Trust Services Criteria. The ones that matter here are the Common Criteria series for logical access (CC6), system operations (CC7) and change management (CC8), plus the availability criteria (A1) if you include that category. HIPAA's technical safeguards are 45 CFR 164.312: access control, audit controls, integrity, person or entity authentication and transmission security.
Read them with an engineer's eye and they sort into three groups.
Provable from configuration. CC6.1 (logical access security over protected assets), CC6.6 (protection against threats from outside the boundary), CC6.7 (protecting information in transmission), CC6.8 (preventing or detecting malicious software), CC7.1 (detecting configuration changes that introduce vulnerabilities), CC7.2 (monitoring for anomalies), A1.2 (backup and recovery infrastructure). On the HIPAA side, audit controls at 164.312(b), integrity at (c), encryption at (a)(2)(iv) and transmission security at (e). For every one of these there is an AWS service whose state is the evidence.
Mixed. CC6.2 and CC6.3 (authorising and removing access, least privilege): Terraform proves the current state and the pull request history proves approval, but auditors still sample joiners, movers and leavers and ask for access reviews. CC8.1 (change management): the repository and CI history is the evidence, the change policy is process. A1.3 (testing recovery): AWS Backup can run restore tests, but someone has to review the results and sign.
People and process. CC7.3 and CC7.4, evaluating and responding to incidents, live in tickets, post-mortems and runbooks. HIPAA's unique user identification and emergency access procedures are required specifications that infrastructure supports but does not satisfy on its own.
The first group is where screenshots are replaced by code. The second is where code provides half the evidence. The third is where a compliance platform's workflow engine is worth paying for.
The baseline module
The module in the repository applies the first group to an account. Each resource block is commented with the criteria it supports. The pieces:
- One audit bucket, versioned, KMS-encrypted with a rotating customer key, Object Lock in compliance mode so that nobody including the root user can delete audit data before its retention expires, public access blocked, TLS required by policy. This is the integrity control for everything that follows.
- CloudTrail, multi-region, global service events included, log file validation on, encrypted, delivered to the audit bucket and to a CloudWatch Logs group with a retention period. Audit controls under 164.312(b) and monitoring under CC7.2 start here.
- AWS Config recording all supported resource types, delivering to the audit bucket, with conformance packs evaluating rules continuously. AWS publishes an "Operational Best Practices for HIPAA Security" pack with 130 rules. There is no SOC 2 pack; the Well-Architected Security Pillar pack and the Security Hub standards cover the same ground.
- Security Hub CSPM with the AWS Foundational Security Best Practices standard and the CIS AWS Foundations Benchmark enabled. AWS renamed the standards-and-controls product "Security Hub CSPM" in 2025 when it launched a new risk-analytics "Security Hub"; the Terraform resources are unchanged.
- GuardDuty for threat detection over CloudTrail, VPC flow and DNS logs (CC6.6, CC6.8).
- IAM Access Analyzer for external and unused access findings (CC6.2, CC6.3).
- Account guardrails: the account-level S3 public access block, EBS encryption by default, and an IAM password policy for the few humans who still have console passwords.
- AWS Backup with a daily plan applied by tag and a vault lock, so backups cannot be deleted early either (A1.2, 164.312(c)).
The whole thing is about 350 lines of Terraform. Applying it is one command. From that point every account looks the same, and the question "is logging enabled in the staging account?" is answered by reading the code, not by logging in to check.
resource "aws_cloudtrail" "account" {
name = "${var.name_prefix}-trail"
s3_bucket_name = aws_s3_bucket.audit.id
is_multi_region_trail = true
include_global_service_events = true
enable_log_file_validation = true
kms_key_id = aws_kms_key.audit.arn
cloud_watch_logs_group_arn = "${aws_cloudwatch_log_group.cloudtrail.arn}:*"
cloud_watch_logs_role_arn = aws_iam_role.cloudtrail_logs.arn
}
One line in that block does more audit work than most teams realise. enable_log_file_validation
makes CloudTrail write signed digest files, and aws cloudtrail validate-logs later proves that
no log file was modified or deleted since delivery. That is the HIPAA integrity mechanism for your
audit trail, in a boolean.
The crosswalk
Auditors work from a list of controls. Engineers work from a list of resources. The crosswalk is the table that joins them, and it is the single most useful artefact in the repository. One row per control: the framework, the control, what it requires, the AWS mechanism, the Terraform resource, and the CLI query that produces the evidence.
| Control | Requirement | Mechanism | Evidence |
|---|---|---|---|
| SOC 2 CC7.1 | Detect configuration changes that introduce vulnerabilities | Config recorder, conformance packs, Security Hub checks | describe-conformance-pack-compliance |
| SOC 2 CC6.7 | Protect information in transmission | TLS-only bucket policies, KMS | get-bucket-policy, get-bucket-encryption |
| SOC 2 A1.2 | Backup processes and recovery infrastructure | Backup plan, locked vault | list-backup-jobs, describe-backup-vault |
| HIPAA 164.312(b) | Record and examine activity in systems holding ePHI | CloudTrail with log validation, Object Lock | validate-logs, get-object-lock-configuration |
| HIPAA 164.312(a)(2)(iv) | Encryption and decryption (addressable) | KMS keys with rotation, default EBS and S3 encryption | get-key-rotation-status, get-ebs-encryption-by-default |
| HIPAA 164.312(e)(1) | Transmission security | TLS-only policies, endpoint TLS policies | get-bucket-policy, describe-listeners |
The full table, 26 rows, is crosswalk.csv in the repository. Hand it to the auditor at the start.
It changes the conversation from "show me" to "run this".
Change management is already your evidence
CC8.1 asks that changes to infrastructure be authorised, tested, approved and implemented. A team that manages infrastructure in Terraform through pull requests already produces that evidence on every change: a diff, a review, a CI run, a merge, an apply log. Add two things and the control is complete.
First, a policy-as-code scan in CI. Checkov runs against the module in the repository and fails the
pull request if someone turns off encryption or opens a security group. Second, branch protection
that requires the review and the scan. The git history then is the change log, with approvals
attached, and aws configservice get-resource-config-history shows the resulting change in the
account. No change advisory board required.
Evidence on demand
The screenshot ritual exists because evidence is collected by hand. The script in the repository replaces it. It makes read-only calls for every row of the crosswalk and writes the results to a dated folder: the password policy, the account public access block, the credential report, the trail status and digest validation, conformance pack compliance, enabled Security Hub standards and failed controls, GuardDuty detectors, backup vaults and the last thirty days of backup jobs, rotation status for every customer-managed key.
./scripts/export-evidence.sh
# ok iam-password-policy
# ok cloudtrail-status-example-prod-trail
# ok config-compliance-example-prod-hipaa-security
# ok securityhub-standards
# ok backup-jobs-30d
# evidence written to evidence/2026-10-05
Run it monthly and store the output in the audit bucket. For a Type I report you hand over the latest folder. For a Type II, which tests operating effectiveness over a period, you hand over twelve of them, and the Object Lock on the bucket is itself evidence that they were not altered.
What the HIPAA Security Rule update changes
In January 2025 the Department of Health and Human Services proposed the first major revision of the Security Rule since 2013. The proposal removes the distinction between required and addressable specifications, mandates encryption of ePHI at rest and in transit with narrow exceptions, requires multi-factor authentication across relevant systems, a written asset inventory and network map reviewed annually, vulnerability scanning at least every six months and penetration testing annually, restoration of critical systems within 72 hours, and an annual compliance audit.
As of October 2026 it is not final. The regulatory agenda now lists final action for mid-2027, and HHS was still working through more than 4,700 comments earlier this year. The 2013 rule is what is enforced today. Build to the proposal anyway. Every item in it is either already in the baseline module (encryption, logging, backups) or a known good practice (MFA, inventory, scanning, restoration testing), and a team that meets it now will not be scrambling when the dates land.
One more thing AWS says plainly and customers forget: there is no HIPAA certification for a cloud provider. You sign AWS's Business Associate Addendum in AWS Artifact, you keep PHI in the services listed as HIPAA eligible, and you remain responsible for configuring those services correctly. The baseline is that configuration.
Build or buy
Compliance platforms sell two things bundled together: integrations that read your cloud configuration and present it as controls, and workflow for policies, training, vendor reviews, risk registers and auditor collaboration. The first half is what this article replaces. The second half is real work that a platform does well, and the price is often justified by it alone once a company is past a few dozen people.
| Decide to | When |
|---|---|
| Build the infrastructure baseline yourself | Always. It is a few hundred lines you will understand, and it works whether or not you later buy a platform |
| Buy a platform for the people workflows | Once policy ownership, onboarding evidence, vendor reviews and auditor requests take more than a day a month of someone's time |
| Buy a platform for infrastructure evidence too | If your auditor or a key customer requires it, or if you have no infrastructure-as-code discipline to build on |
If you buy, point the platform's integrations at an account that already runs the baseline. You will find that most of its infrastructure checks pass on day one, which is a better negotiating position than the alternative.
What it costs to run
The baseline turns on three services billed by usage. At the published US East rates, AWS Config charges $0.003 per configuration item recorded and $0.001 per rule evaluation for the first 100,000 in a month; Security Hub CSPM charges $0.001 per security check for the first 100,000, and findings from its own checks are free; GuardDuty charges $4.00 per million CloudTrail management events and $1.00 per GB of flow and DNS logs for the first 500 GB. For a typical small production account that comes to tens of dollars a month, dominated by Config items in accounts with a lot of churn. Security Hub's security checks are free of Config rule charges when the rules are enabled only by Security Hub standards; the configuration items are still billed.
The 90-day plan
The repository includes the infrastructure track to Type I readiness: decide and baseline in the first two weeks, close the findings that matter and put review and scanning in front of every change by day 45, make evidence export a monthly routine by day 75, and walk the crosswalk with the auditor in the final two weeks. The people track runs alongside it, and the plan is honest about what cannot be automated: risk assessment, policy approval, training, vendor management, incident decisions, and the judgement in an access review.
When this is wrong
If your estate was built by hand in the console and nobody can say what is in it, fix that first; automating evidence for drift you do not understand produces confident nonsense. If an auditor or anchor customer mandates a particular platform, use it and feed it a baseline account. And in an organisation of a few hundred people, the people controls dominate the audit, and the platform earns its fee regardless of how good the Terraform is.
The checklist
- The BAA is signed if PHI is in scope, and PHI stays in HIPAA-eligible services.
- Every account runs the baseline: audit bucket with Object Lock, CloudTrail with log validation, Config with conformance packs, Security Hub standards, GuardDuty, Access Analyzer, Backup with vault lock, account guardrails.
- Infrastructure changes go through pull requests with a policy scan and a human review.
- The crosswalk exists, is current, and names an owner per control.
- Evidence is exported by script monthly and stored immutably.
- Failed Security Hub controls are either fixed or accepted in writing with a date.
- A restore has been run from backup in the last quarter, with the job id kept.
- The people track has an owner, a plan and, if needed, a platform.
The module, the crosswalk, the evidence script and the plan are in the engineering notes repository.

Written by
Praveen Kumar
Use this article
