Lesson 3 of 3 Data Protection and Encryption

Encrypting Data at Rest and in Transit Across AWS Services

Most AWS services can encrypt data, but the defaults, options and enforcement mechanisms differ by service. This lesson explains how data at rest is encrypted in the main storage and database services, how data in transit is protected with TLS and network encryption, and how encryption is enforced and verified across an organisation so that unencrypted data cannot be created.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain how data classification determines the encryption, key management and access controls a dataset receives.
  • Describe encryption at rest options for Amazon S3, EBS, RDS and Aurora, DynamoDB, EFS and messaging services.
  • Explain which encryption settings must be chosen at creation and how existing unencrypted data is encrypted.
  • Describe how data in transit is encrypted with TLS on load balancers, databases and caches, and how TLS is required.
  • Explain how encryption is enforced and verified at scale with account defaults, policies and Config rules.

Classifying Data Before Protecting It

Encryption settings, key ownership, access rules and retention should depend on how sensitive the data is. Treating every dataset as top secret makes systems expensive and hard to use, and treating every dataset as public exposes the data that matters. Data classification resolves this by assigning each dataset a level that determines the controls it receives. The exam guide lists data classification, encryption, key management and access controls together as data management, because classification is the input that the other three depend on.

A typical scheme has three to five levels, such as public, internal, confidential and restricted. Each level is defined by the harm that disclosure would cause, and each maps to concrete controls. Public data may use default encryption. Confidential data may require a customer managed KMS key, TLS for all access and access limited to named roles. Restricted data, such as payment card or health records, may additionally require a dedicated account, strict key policies with separation of duties, logging of every data access and automated discovery to ensure that copies do not appear elsewhere.

On AWS, the classification is usually recorded as a tag on accounts, buckets, databases and keys, such as data-classification=restricted. Tags make the classification machine-readable, so that policies can act on it: an SCP or tag policy can require the tag on new resources, attribute-based access control can allow access only to principals cleared for the level, and AWS Config rules can check that resources tagged restricted use a customer managed key. Because people misclassify data, Amazon Macie, covered in the previous module, verifies the classification by discovering sensitive data in S3 and reporting buckets whose contents do not match their label.

Encryption at Rest by Service

Encryption at rest protects data on disk, in backups and in snapshots, so that physical media or copied storage cannot be read without the key. On AWS, almost every storage and database service encrypts through AWS KMS, and the decisions are the same everywhere: which key type to use and when the setting can be chosen. The default AWS owned or AWS managed key encrypts the data but gives the customer no control over the key policy. A customer managed key adds that control: the key policy decides who can decrypt, independently of who can read the storage, every use is recorded in CloudTrail, and disabling the key makes the data unreadable, which supports separation of duties and crypto-shredding.

The second difference between services is timing. Some services encrypt everything by default, such as S3 for new objects and DynamoDB for every table. Others, such as RDS, Aurora and EFS, fix the setting when the resource is created, so an unencrypted resource can only be encrypted by creating a new one. This is why preventive controls, which stop unencrypted resources being created, matter so much for these services. The table below summarises the main options.

ServiceDefaultOptionsNotes
Amazon S3SSE-S3 for all new objectsSSE-KMS, DSSE-KMS (dual layer), SSE-C (customer-provided keys)Bucket default encryption; Bucket Keys reduce KMS cost
Amazon EBSOptional; account-level encryption by default settingAWS managed or customer managed KMS keySnapshots and volumes from them inherit encryption
Amazon RDS and AuroraEncryption chosen at creationAWS managed or customer managed KMS keyCannot encrypt an existing instance in place
Amazon DynamoDBAlways encrypted (AWS owned key)AWS managed or customer managed keyCan switch keys on an existing table
Amazon EFSChosen at creationAWS managed or customer managed keyCannot encrypt an existing file system
Amazon SQS and SNSSQS managed SSE by defaultSSE-KMSPublishers need KMS permissions for KMS-encrypted topics and queues
CloudWatch LogsEncrypted by the serviceCustomer managed KMS key per log groupKey policy must allow the logs service
Secrets Manager, Parameter StoreEncrypted with KMSCustomer managed keyRequired for cross-account secrets

Encrypting existing unencrypted data

Several services fix encryption at creation. An unencrypted EBS volume is encrypted by creating a snapshot, copying it with encryption enabled and creating a new volume; enabling EBS encryption by default makes all new volumes encrypted. An unencrypted RDS instance is encrypted by taking a snapshot, copying the snapshot with encryption, and restoring a new instance from the encrypted copy, which requires a cutover; AWS DMS or a read replica-based migration can reduce downtime. An unencrypted EFS file system requires a new encrypted file system and a copy of the data, or a restore from an AWS Backup recovery point into a new encrypted file system. Existing S3 objects can be re-encrypted with S3 Batch Operations copy jobs.

Encryption in Transit

Data in transit is protected primarily with TLS. AWS service endpoints support TLS, and policies can require it: a bucket policy that denies requests where aws:SecureTransport is false forces HTTPS to S3, and similar conditions apply to SQS, SNS and other resource policies.

  • Load balancers: ALB HTTPS listeners and NLB TLS listeners terminate TLS with ACM certificates and a security policy that defines the allowed protocol versions and ciphers, such as TLS 1.2 and 1.3 only. For end-to-end encryption, the load balancer connects to targets over HTTPS or TLS as well, or an NLB passes TLS through to targets with TCP listeners.
  • CloudFront: viewer protocol policies redirect HTTP to HTTPS, and origin protocol policies require HTTPS to origins.
  • Databases: RDS and Aurora support TLS connections with AWS-provided certificate authorities; the parameter rds.force_ssl (PostgreSQL, SQL Server) or require_secure_transport (MySQL) rejects unencrypted connections.
  • Caches: ElastiCache in-transit encryption is enabled for clusters, with AUTH or IAM authentication.
  • Networks: Site-to-Site VPN uses IPsec between networks; AWS Client VPN gives individual users a TLS-encrypted connection into a VPC, authenticated with certificates, Active Directory or SAML; Direct Connect can use MACsec or VPN over Direct Connect; traffic between supported Nitro instance types within AWS is encrypted automatically at the hardware level.
  • Service-to-service: mutual TLS with private certificates, for example through ECS Service Connect TLS or a service mesh.
Match the pairs

Require TLS everywhere

Exam skills 6.2.4

Match each service with how TLS is required for it.

Log in to try this activity Interactive activities are free with an account.

Enforcing and Verifying Encryption at Scale

Encryption should be the default, enforced so that unencrypted data cannot be created, and verified continuously. In an organisation with hundreds of accounts, no review process can check every new volume, bucket and database by hand, so the controls must be automatic and must operate at two points. Preventive controls act before a resource exists: account-level defaults make new resources encrypted without anyone choosing it, SCPs and resource policies deny API calls that would create unencrypted resources or send data without TLS, and CloudFormation Hooks reject templates that declare them.

Detective controls act after the fact: AWS Config rules and Security Hub controls find resources that slipped through, such as those created before the preventive controls existed or in a Region that was missed, and they provide the continuous evidence that auditors ask for. Neither kind is sufficient alone. Prevention without detection leaves legacy resources unseen, and detection without prevention means non-compliant resources keep being created and must be fixed one by one. The table below lists the mechanisms by type.

MechanismExampleType
Account defaultsEBS encryption by default in every account and Region; S3 default encryptionPreventive
SCPsDeny ec2:CreateVolume when ec2:Encrypted is false; deny rds:CreateDBInstance when rds:StorageEncrypted is falsePreventive
Resource policiesDeny S3 requests without aws:SecureTransport; require a KMS key with s3:x-amz-server-side-encryption-aws-kms-key-idPreventive
CloudFormation Hooks and Control Tower proactive controlsReject templates that create unencrypted resourcesPreventive
AWS Config rulesencrypted-volumes, rds-storage-encrypted, s3-bucket-ssl-requests-only, elb-tls-https-listeners-onlyDetective
Security Hub controlsFSBP encryption controls across accountsDetective

Prevent, then detect

For "ensure no unencrypted EBS volumes can be created in any account", the preventive answers are EBS encryption by default plus an SCP; a Config rule alone only detects them after creation.

Sort into groups

Prevent or detect?

Exam skills 6.2.4 · 6.2.1

Decide whether each mechanism prevents unencrypted data or detects it.

Log in to try this activity Interactive activities are free with an account.
Worked example

An Encryption Baseline for an Organisation

A financial services company must guarantee that all data stores are encrypted with customer managed keys, that all connections use TLS 1.2 or later, and that it can prove both to auditors.

  1. Defaults

    A StackSet enables EBS encryption by default with a customer managed key in every account and Region.

  2. Prevention

    SCPs deny creating unencrypted EBS volumes, RDS instances and EFS file systems; bucket policies require TLS and SSE-KMS with the approved key.

  3. Transit

    Firewall Manager and Config rules check that load balancers use HTTPS listeners with TLS 1.2+ security policies; RDS parameter groups force TLS.

  4. Evidence

    Security Hub FSBP controls and a conformance pack of encryption rules provide continuous compliance reports.

  5. Legacy data

    Unencrypted RDS instances found by the rules are migrated through encrypted snapshot copies during maintenance windows.

Check yourself

How is an existing unencrypted Amazon RDS instance encrypted?

Show answer

Take a snapshot, copy the snapshot with encryption enabled using a KMS key, restore a new instance from the encrypted copy and switch the application to it. Encryption cannot be enabled in place.

Exam Tips

Remember for the exam

  • S3 encrypts new objects with SSE-S3 by default; use SSE-KMS with a customer managed key for control; Bucket Keys reduce KMS cost.
  • RDS, EFS and (without defaults) EBS encryption are chosen at creation; encrypt existing data through encrypted snapshot copies and restores.
  • Require TLS with aws:SecureTransport conditions, ALB/NLB security policies, rds.force_ssl or require_secure_transport, and HTTPS-only CloudFront policies.
  • Prevent unencrypted resources with account defaults, SCPs, resource policies and hooks; detect with Config rules and Security Hub.