Skip to main content

Network and encryption

How traffic is segmented and inspected, and how data is encrypted at rest and in transit — the two policies that determine most of a workload's exposure.

Network security policy​

The standard. VPC segmentation and traffic control — security groups between the internet and the VPC, between workloads, NACLs at the subnet boundary — plus the data encryption policy applied across projects.

VPC design​

VPC 10.0.0.0/16
├── public-a 10.0.1.0/24 ── load balancer, NAT gateway
├── public-b 10.0.2.0/24
├── private-a 10.0.11.0/24 ── application
├── private-b 10.0.12.0/24
├── data-a 10.0.21.0/24 ── databases
└── data-b 10.0.22.0/24
RuleReason
Minimum two Availability ZonesA single-AZ design fails on an AZ event
Workloads with no internet requirement in private subnetsRemoves the primary exposure path
Data subnets have no route to the internetEven via NAT
Separate route tables per tierPrevents accidental transit between tiers
NAT gateways one per AZA single NAT gateway is a cross-AZ dependency and a cost and availability risk

Security groups​

Security groups are the primary control. Rules are least-privilege and reference other security groups, not CIDR blocks, wherever possible.

TierInboundOutbound
ALB443 from 0.0.0.0/0; 80 from 0.0.0.0/0 redirecting to 443Application SG on the application port
ApplicationApplication port from ALB SG onlyData SG on the database port; HTTPS to approved endpoints
DataDatabase port from application SG onlyNone required
resource "aws_security_group_rule" "app_from_alb" {
type = "ingress"
from_port = 8080
to_port = 8080
protocol = "tcp"
security_group_id = aws_security_group.app.id
source_security_group_id = aws_security_group.alb.id
}

Never 0.0.0.0/0 on a database port. Never 0.0.0.0/0 on SSH. Use Session Manager instead.

Network ACLs​

NACLs are stateless and subnet-level. Use them as a coarse, explicit backstop:

  • Default-deny inbound on data subnets, with explicit allows from application subnet ranges.
  • Deny explicit known-bad ranges at the edge.
  • Ephemeral port ranges allowed for return traffic.
  • Every rule numbered with room to insert; every rule documented.

NACLs are not a substitute for security groups — they are a second, independent layer.

VPC endpoints​

Traffic to AWS services should not leave the VPC where it does not have to.

Endpoint typeUse
Gateway endpointS3, DynamoDB — no hourly charge
Interface endpointECR, CloudWatch Logs, Secrets Manager, SSM, KMS, STS

Endpoint policies restrict which buckets, repositories or secrets are reachable through the endpoint, narrowing the path further.

Flow logs​

  • Enabled on every VPC, delivering to a central bucket.
  • Retention set to meet the compliance requirement; one week is a diagnostic window, not an audit record.
  • Rejected traffic reviewed; an internal host being denied repeatedly is a signal.

Egress​

  • Default-deny egress from application subnets to the internet.
  • Approved external integrations reached through a fixed set of endpoints.
  • AWS Network Firewall or a NAT with domain allow-listing where the workload has no legitimate general internet requirement.
  • DNS resolution through Route 53 Resolver with DNS Firewall.

Data encryption policy​

The standard. A single encryption policy across projects: how public endpoints are protected, how outbound requests are secured, and how data is encrypted at rest with keys managed centrally.

In transit​

PathControl
Client → CloudFront / ALBTLS 1.2+; certificates in ACM; HTTP redirected to HTTPS; HSTS
ALB → applicationTLS where the application supports it; private network otherwise
Application → RDSTLS required; rds.force_ssl enabled
Application → ElastiCacheTLS enabled
Application → S3 / DynamoDBHTTPS to the regional endpoint, ideally via a VPC endpoint
Application → third-party APITLS 1.2+ with certificate validation; no --insecure
Internal service → servicemTLS or service mesh where the workload requires identity-based auth
Administrative accessSession Manager over TLS; no direct SSH

At rest​

ServiceEncryptionKey
S3SSE-KMSCustomer-managed key per classification
EBSEncrypted by defaultAccount default KMS key
RDS / AuroraKMSPer-workload key
DynamoDBKMSPer-workload key
ElastiCacheAt-rest encryptionPer-workload key
EFSKMSPer-workload key
CloudWatch LogsKMSLog-specific key
SQS / SNSKMSPer-workload key
BackupsKMSBackup key; cross-region replica encrypted
SecretsKMSSecrets-specific key

Key management​

  • Keys are per classification and per service boundary, not one key for everything.
  • Key policy separates administration from use:
{
"Sid": "AllowKeyAdministration",
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::<account>:role/key-admin"},
"Action": ["kms:Create*", "kms:Describe*", "kms:Enable*", "kms:Put*", "kms:Update*"],
"Resource": "*"
},
{
"Sid": "AllowKeyUsage",
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::<account>:role/app-role"},
"Action": ["kms:Decrypt", "kms:GenerateDataKey"],
"Resource": "*",
"Condition": {
"StringEquals": {"kms:ViaService": "s3.us-east-1.amazonaws.com"}
}
}
  • Automatic rotation enabled where supported.
  • Deletion requires a waiting period and raises an alarm.
  • Cross-account access uses grants, not broad key policies.
  • Key usage is logged in CloudTrail and reviewed.

Data classification​

ClassificationExamplesEncryptionAccess
PublicMarketing contentAt rest and in transitOpen
InternalInternal reportsAt rest and in transitStaff
ConfidentialCustomer records, billingCustomer-managed KMS keyNamed roles
RestrictedPayment data, health data, credentialsDedicated key, restricted key policyMinimal named roles, audited

Evidence​

  • VPC and subnet diagram with route tables.
  • Security group rules export.
  • NACL configuration.
  • VPC Flow Logs and endpoint configuration.
  • Encryption configuration per service.
  • Key policy and rotation settings.
  • TLS policy on every public listener.