AWS Lambda PHI Handling Best Practices for HIPAA-Compliant Serverless Applications

Product Pricing
Ready to get started? Book a demo with our team
Talk to an expert

AWS Lambda PHI Handling Best Practices for HIPAA-Compliant Serverless Applications

Kevin Henry

HIPAA

May 30, 2026

7 minutes read
Share this article
AWS Lambda PHI Handling Best Practices for HIPAA-Compliant Serverless Applications

Building serverless healthcare workloads means treating protected health information (PHI) as a first‑class design constraint. This guide shows you how to configure AWS Lambda and its surrounding services to meet HIPAA expectations by addressing eligibility, encryption, data handling, secrets, access control, monitoring, and audit evidence.

AWS Lambda HIPAA Eligibility

Scope and shared responsibility

AWS Lambda is appropriate for PHI only when your organization has an executed AWS Business Associate Addendum (AWS Business Associate Addendum) with AWS and you restrict PHI to HIPAA‑eligible services. Under the shared responsibility model, AWS manages the infrastructure; you must harden configurations, control access, encrypt data, and validate processes.

Service selection and architecture

Confirm that every integrated component—API Gateway, S3, DynamoDB, SQS, EventBridge, or others—appears on the HIPAA‑eligible list before it ever touches PHI. Design data flows that minimize where PHI travels, and document those flows so auditors can trace collection, processing, storage, and deletion paths end to end.

Configuration essentials

  • Use VPC‑enabled Lambdas for systems that access PHI stores, and prefer VPC endpoints to avoid public internet egress.
  • Disable public invocation paths; tie invocation strictly to trusted services via resource policies.
  • Avoid putting PHI in environment variables; if unavoidable, encrypt with AWS Key Management Service and restrict decryption to specific function aliases.
  • Validate inputs and outputs to ensure only the minimum necessary data is processed.
  • Adopt code signing for Lambda to ensure only trusted packages are deployed.

Encryption of PHI

Encryption in transit

Enforce TLS 1.2+ for every network hop that can carry PHI—client to API Gateway, service‑to‑service calls, and traffic to data stores. Prefer private connectivity (VPC endpoints) and verify certificates; if you expose public endpoints, use strong ciphers and HSTS at the edge.

Encryption at rest

Use AWS Key Management Service for at‑rest protection everywhere: SSE‑KMS for S3 objects, KMS‑backed encryption for DynamoDB, EFS, EBS snapshots, and SQS. If a process must temporarily write PHI to /tmp, encrypt before writing and securely delete on completion.

Key management practices

  • Prefer customer‑managed KMS keys with narrowly scoped key policies and automatic annual rotation.
  • Separate duties: platform teams manage keys; application roles use them via least privilege.
  • Use condition keys and encryption context to bind decryption to specific roles, aliases, or VPCs.
  • Apply preventive controls (SCPs and IAM policies) that deny writes of PHI to storage unless KMS encryption is used.

Secure Data Handling Practices

Minimize and sanitize

Only collect the minimum necessary PHI. Where possible, tokenize, hash, or truncate identifiers before storage or transmission. Never place PHI in Lambda function names, tags, metric dimensions, CloudWatch log messages, S3 object keys, or DynamoDB partition/sort keys.

Runtime hygiene

Avoid persisting PHI beyond what the business process requires. Keep sensitive payloads in memory, and if caching is required, enforce short TTLs and encryption. Do not rely on container reuse; each invocation should assume a clean slate and explicitly clear sensitive buffers.

Network and storage boundaries

  • Use private subnets and VPC endpoints to reach S3, DynamoDB, Secrets Manager, and Parameter Store without NAT egress.
  • Isolate environments (dev/test/prod) and PHI/non‑PHI workloads using separate accounts and strict routing boundaries.
  • Apply lifecycle and retention controls—S3 lifecycle rules and DynamoDB TTL—to delete PHI when it is no longer needed.

Secrets Management Strategies

Where to store what

Keep credentials, API keys, and database passwords in AWS Secrets Manager for centralized rotation and auditing. Store application configuration in Systems Manager Parameter Store as SecureString when it must be confidential. Many teams colloquially refer to “AWS Secrets Manager SecureString”; in practice, use Secrets Manager for rotating secrets and Parameter Store SecureString for non‑rotating confidential settings.

Ready to simplify HIPAA compliance?

Join thousands of organizations that trust Accountable to manage their compliance needs.

Rotation and retrieval

  • Enable automatic rotation with Lambda for databases and third‑party credentials; validate rotation with integration tests before production.
  • Retrieve secrets at runtime using the function’s IAM role; do not bake secrets into code, layers, or environment variables.
  • Cache secrets in memory briefly and refresh on expiration; never write secrets to logs or /tmp.

Access controls for secrets

  • Attach resource policies to secrets that restrict access by principal, VPC endpoint, and source account.
  • Back secrets with customer‑managed KMS keys and limit kms:Decrypt to specific Lambda roles and aliases.

Access Control Implementation

IAM least privilege

Grant Lambda execution roles only the actions they truly need using IAM least-privilege policies. Scope by resource ARN, enforce conditions (for example, aws:ResourceTag, aws:SourceVpce), and include explicit denies for risky broad actions. Use permission boundaries to cap what developers can grant.

Invocation and resource policies

Restrict who can invoke your function. Use Lambda resource‑based policies so only specific API Gateway stages, EventBridge rules, or SQS queues can call it. For outbound access, apply VPC security groups that allow only required destinations and protocols.

Organization guardrails

  • Use Service Control Policies to require encryption with AWS Key Management Service and to block creation of public resources in PHI accounts.
  • Enforce code signing requirements and restrict runtime versions to those receiving security updates.
  • Adopt break‑glass roles with MFA and just‑in‑time access for emergency production troubleshooting.

Monitoring and Logging Requirements

Auditability with CloudTrail

Enable AWS CloudTrail audit logs across all regions and include data events for S3 and Lambda. Centralize trails in a dedicated logging account, encrypt with KMS, and apply immutable retention. Alert on changes to trails, KMS keys, and IAM policies.

Application logging without PHI

Log metadata and identifiers that are safe and useful, not raw PHI. Use structured JSON with explicit redaction of names, addresses, SSNs, MRNs, and free‑text fields. Encrypt CloudWatch Logs with KMS, set strict retention, and restrict access to least‑privileged roles.

Detections and guard services

  • Create CloudWatch Alarms for anomalous invocation patterns, access denials, and decryption failures.
  • Use AWS Config rules to enforce encryption, private networking, and restricted public access on PHI resources.
  • Leverage Security Hub and GuardDuty for continuous findings, and consider Macie to detect accidental PHI in S3.

Compliance Documentation and Auditing

Evidence you will need

Maintain signed copies of the AWS Business Associate Addendum, architecture diagrams, data‑flow maps, key policies, and incident response runbooks. Export IAM policy reviews, change approvals, and sample sanitization tests as traceable artifacts.

Using AWS native reports

Collect AWS Artifact compliance reports (for example, SOC and HIPAA‑aligned guidance) and attach them to your control matrix. Pair them with your own CloudTrail queries, Config snapshots, and deployment records to demonstrate control operation and continuous monitoring.

Operational audits

  • Conduct periodic access reviews for Lambda roles, KMS keys, and secrets.
  • Test backup and restore, rotation, and incident response procedures with tabletop exercises.
  • Automate evidence capture during deployments so every change has linked approvals and release notes.

Conclusion

HIPAA‑ready serverless design is achievable when you align AWS Lambda with strong encryption, IAM least‑privilege policies, disciplined secrets management, rigorous logging and monitoring, and thorough documentation. Treat PHI as a constraint on every decision, and your applications will be secure, auditable, and scalable.

FAQs

What makes AWS Lambda HIPAA-eligible?

Lambda can process PHI when your organization has an executed AWS Business Associate Addendum and you use only HIPAA‑eligible services in the data path. You must configure encryption, access controls, monitoring, and data‑handling safeguards that meet your policies and the HIPAA Security Rule.

How should PHI be encrypted in AWS Lambda environments?

Use TLS 1.2+ for all network connections and encrypt data at rest with AWS Key Management Service. Prefer customer‑managed KMS keys, rotate them annually, and require SSE‑KMS for S3, KMS‑backed encryption for databases and queues, and application‑level encryption for any temporary files written to /tmp.

What are the best practices for managing secrets in Lambda functions?

Store credentials in AWS Secrets Manager and enable automatic rotation; keep confidential configuration in Parameter Store as SecureString. Retrieve secrets at runtime with the function’s role, cache them briefly in memory, and never log or embed them in code or environment variables. Many teams refer to “AWS Secrets Manager SecureString,” but practically you should pair Secrets Manager with SecureString where appropriate.

How can logging and monitoring be configured for HIPAA compliance?

Enable AWS CloudTrail audit logs for all regions and data events, encrypt and centralize them, and set immutable retention. Use structured, PHI‑free application logs in CloudWatch with KMS encryption and defined retention. Add Config rules, Security Hub, and GuardDuty for continuous detection, plus alarms for access anomalies and failed decryptions.

Share this article

Ready to simplify HIPAA compliance?

Join thousands of organizations that trust Accountable to manage their compliance needs.

Related Articles