CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
  • Week 1
    • 1.What Is Data Engineering
    • 2.Batch vs Streaming
    • 3.A Bird's-Eye View of AWS Data Services
    • 4.Data Formats and Modeling
    • 5.Week 1 Comprehensive Review
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
    • 1.Access Control: IAM and Lake Formation Permissions
    • 2.Encryption: KMS and Per-Service Encryption
    • 3.Protecting Sensitive Data: Macie and Masking
    • 4.Data Governance: Catalog, Lineage, Sharing, and Auditing
    • 5.Week 9 Review: Security and Governance
  • Week 10
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← DEA-C01/Week 9/Day 2

Based on the DEA-C01 exam guide·Report an error

DEA-C01· AssociateWeek 9 · Day 2~31 min read

Day 2 - Encryption: KMS and Per-Service Encryption

📌 Key Takeaways

  • Encryption at rest and encryption in transit are separate layers. You have to enforce both.
  • KMS does not encrypt your data directly. This is envelope encryption: a KMS key wraps a data key, and the data key encrypts the actual data.
  • S3 splits into SSE-S3 (applied by default, no key control) / SSE-KMS (key policy, auditing, bucket keys) / DSSE-KMS (dual layer) / SSE-C (customer-provided keys) / client-side (AWS never sees the plaintext).
  • The center of KMS access is the key policy. Service roles and cross-account principals must be allowed in the key policy (or a grant).
  • Reduce the KMS call cost and throttling of SSE-KMS with an S3 Bucket Key, and block plaintext HTTP with an aws:SecureTransport deny condition.

The Three Kinds of KMS Keys

Data has to be protected both while it is stored and while it moves. At the center of encryption on AWS is KMS (Key Management Service), and data services such as S3, Redshift, and Glue integrate with KMS to use keys.

AspectAWS owned keyAWS managed keyCustomer managed key
Visible in your accountNoYes (aliases like aws/s3)Yes
Edit the key policyNoNoYes
RotationHandled by the serviceAutomatic every year (cannot be turned off)Optional. Turn on automatic rotation or rotate manually
Cross-account useNoNo (you cannot change the policy)Yes
Delete / disableNoNoYes
Cost structureNoneNo key storage fee, usage requests are chargedKey storage fee (monthly) + usage requests
Clue for choosingWhen you don't want to think about itWhen you need audit records but don't want the management burdenWhen you must hold access control, rotation, cross-account use, and auditing yourself
  • CMK (Customer Master Key) in older material is the former term for what is now called a "KMS key." Exam questions may mix both terms.
  • The automatic rotation period of AWS managed keys changed from 3 years to 1 year in May 2022. Older material still says 3 years.

How Envelope Encryption Actually Works

Write
 ① The service sends a GenerateDataKey request to KMS
 ② KMS returns the data key in two forms: a plaintext data key + a data key encrypted by the KMS key
 ③ The service encrypts the data with the plaintext data key and discards the plaintext key from memory
 ④ The ciphertext data + the encrypted data key are stored together
 
Read
 ⑤ The service sends the encrypted data key to KMS with a Decrypt request
 ⑥ KMS checks the key policy and returns the plaintext data key
 ⑦ The service decrypts the data with that key
  • The KMS key itself never leaves KMS. Only data keys travel in and out.
  • Large data is encrypted with the data key on the service side, so there is no latency or cost from sending the whole dataset to KMS.
  • The KMS permission the reader needs is kms:Decrypt, and the writer needs kms:GenerateDataKey. "I have S3 permission but can't read an SSE-KMS object" is almost always blocked at step ⑥.

💡 Related theory: KMS does not encrypt the data itself; it manages data keys. That is why rotating a KMS key does not re-encrypt data that is already stored. What changes is the key material used to wrap data keys from then on.

Key Policy: The Center of KMS Access

  • A key policy is the resource-based policy of a KMS key. Unlike other resource policies, a key policy does not automatically grant permissions to the account or to principals in the account.
  • The default key policy contains a statement that allows kms:* to the account root principal. This statement is what makes it possible to allow key access through IAM policies. Without it, an Allow in an IAM policy has no effect (a Deny still does).
  • For cross-account access, the key policy in the key-owning account must allow the other account, and the other account's IAM policy must allow use of that key. Both sides are required.
  • A grant is a way to delegate only limited operations to a specific principal. It is mostly created when an AWS service uses a key on a user's behalf.
{
  "Sid": "AllowGlueRoleUseOfKey",
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::111122223333:role/GlueETLRole" },
  "Action": ["kms:Decrypt", "kms:GenerateDataKey"],
  "Resource": "*"
}
  • In a key policy, a Resource of * means "this very key the policy is attached to." It does not mean all keys.
  • To allow use only when it goes through a specific service, use the kms:ViaService condition. For example, if you allow decryption only through S3, the path where the same role calls the KMS API directly to use the key is closed.

Rotation and Deletion

ItemDetails
Automatic rotationOptional for customer managed keys. When enabled, it creates new key material every 365 days by default, and you can set the period yourself
On-demand rotationRotates immediately, regardless of the automatic rotation setting
Eligible for automatic rotationSymmetric encryption keys with KMS-generated key material. Asymmetric, HMAC, and custom key store keys are rotated manually (create a new key, then switch the alias)
Unchanged after rotationKey ID, ARN, key policy, alias
Past dataThe previous key material is preserved, so it still decrypts. No re-encryption takes place
DeletionThere is no immediate deletion. You schedule it with a waiting period of 7 to 30 days (default 30), and you can cancel during that time
  • Once a key is deleted, data encrypted with that key cannot be recovered. If you are not certain, disable it instead of deleting it. Disabling is reversible.
  • A key in its waiting period cannot be used for cryptographic operations. During this period, use CloudTrail and alarms to check who is still using the key.
  • Rotation does not reduce the damage from a leaked data key. The reason you need rotation is usually a regulation or contract.

Five Ways to Encrypt S3 at Rest

MethodKey ownerKey control / auditingCaveats
SSE-S3S3NoneApplied by default to all new objects since January 5, 2023, at no additional cost. Cannot be turned off
SSE-KMSKMS keyKey policy, CloudTrail recordsA KMS call per object, so cost and throttling are possible → bucket key
DSSE-KMSKMS key (dual layer)Same as SSE-KMSFor dual-encryption regulations. Does not support bucket keys
SSE-CCustomer provides the key on every requestS3 does not store the keyHTTPS required, not usable from the console, lose the key and you lose the object
Client-side encryptionCustomerAWS receives only ciphertextEncryption, decryption, and key management are entirely the application's responsibility
  • Even if you change default encryption to SSE-KMS, existing objects stay as they are. To change existing objects you have to rewrite them by copying (for example with S3 Batch Operations).
  • SSE-C is blocked by default on new general purpose buckets starting April 2026. To use it, you have to allow it explicitly in the bucket's encryption settings. Older material describes SSE-C as an option you can use unconditionally.
  • AWS services cannot open SSE-C and client-side encrypted objects. Macie reports only the metadata of such objects, and it is also hard to analyze them directly with services like Athena.
  • Server-side encryption (SSE) is applied by S3 after it receives the data. At the moment of receipt, the plaintext passes through S3. Only client-side encryption satisfies a requirement that "AWS must never be able to see the plaintext."
{
  "ServerSideEncryptionConfiguration": {
    "Rules": [{
      "ApplyServerSideEncryptionByDefault": {
        "SSEAlgorithm": "aws:kms",
        "KMSMasterKeyID": "arn:aws:kms:ap-northeast-2:111122223333:key/abcd-1234"
      },
      "BucketKeyEnabled": true
    }]
  }
}

How S3 Bucket Key Works and Its Side Effects

  • Without a bucket key, S3 requests a data key from KMS for every object. An ETL job that reads millions of objects runs into KMS request charges and request limits.
  • With a bucket key enabled, S3 obtains a short-lived bucket-level key from KMS and uses it to generate per-object data keys. Requests to KMS drop sharply, which can cut request costs by up to 99%.
  • Control over the KMS key stays the same. That is why, for a requirement of "reduce cost but keep key control," the answer is a bucket key, not a switch to SSE-S3.
Changes to know before turning it onDetails
KMS events in CloudTrailThe bucket ARN is logged instead of the object ARN, and the number of events drops. Per-object KMS auditing becomes blurrier
Encryption contextIAM and key policies that use the object ARN as a condition stop working. Fix them to use the bucket ARN
Existing objectsNot affected. It applies from newly written objects
Size of the savingsIf the requester (role or account) differs, a separate bucket key is obtained for each. The savings are larger with fewer requesters reading many objects in a short time
DSSE-KMSNot supported

Where to Configure Encryption per Service

ServiceSettingPoints to know
RedshiftEncryption of the cluster / serverless namespaceEncrypted by default now. The default key is an AWS owned key, and you can specify a customer managed key. Snapshots are encrypted as well
Glue ETLSecurity configurationA bundled setting for encrypting S3 target data, CloudWatch logs, and job bookmarks. Attached to jobs, crawlers, and development endpoints
Glue Data CatalogCatalog settingsMetadata encryption is a separate setting from the security configuration
Kinesis Data StreamsServer-side encryption of the streamSet per stream with a KMS key
AthenaResult encryption in the workgroupEven if the source is encrypted, the query result location is configured separately
  • Redshift: You can also encrypt an existing unencrypted cluster by changing the setting. Redshift then migrates the data to a new encrypted cluster. RA3 families allow reads and writes while this is in progress, but DC2 allows reads only. The older material's "only possible at creation" and "manage keys with HSM" differ from the current behavior. HSM integration is exclusive to the legacy CloudHSM Classic and is not supported on DC2 and RA3 nodes.
  • If you disable a customer managed key for Redshift, the warehouse becomes inaccessible, and if you do not restore the key within 14 days, it is deleted. This is a path where a key operations mistake leads to data loss.
  • KMS keys are bound to a Region. If you copy a Redshift snapshot to another Region and want to use your own key in the destination Region, first create a snapshot copy grant in the destination Region.
  • Glue security configuration: To encrypt CloudWatch logs with KMS, the key policy must allow the logs service principal, and the job role must have logs:AssociateKmsKey. If it is missing, real-time logging is turned off. A job running inside a VPC fails with a KMS timeout if there is no path to KMS (a KMS VPC endpoint or a NAT).
  • Once a security configuration is attached, an SSE-S3 setting passed as a job parameter is ignored. If the two overlap, the security configuration wins.

Encryption in Transit

  • AWS API endpoints support TLS. The issue is whether plaintext HTTP is allowed. You enforce this by denying requests where aws:SecureTransport is false in the bucket policy.
  • Redshift enforces SSL connections with require_ssl in the parameter group.
{
  "Effect": "Deny",
  "Principal": "*",
  "Action": "s3:*",
  "Resource": ["arn:aws:s3:::lake-curated", "arn:aws:s3:::lake-curated/*"],
  "Condition": { "Bool": { "aws:SecureTransport": "false" } }
}

💡 Related theory: Encryption at rest and encryption in transit are separate protection layers. Even if storage is encrypted with SSE-KMS, data sent over plaintext HTTP is exposed to man-in-the-middle attacks. In a security review question, if "it's encrypted but it was flagged," look for the missing layer.

Client-Side Encryption

  • The application encrypts the data itself before it goes to AWS. You implement it with the AWS Encryption SDK or the S3 encryption client.
  • You can wrap the data key with a KMS key (the key is in KMS, encryption and decryption happen on the client), or you can use your own keys.
  • AWS receives only ciphertext. It gives the strongest confidentiality, but it makes server-side features (direct analysis by services, sensitive data detection) hard to use and raises operational complexity.

Symptom → Cause → Action

SymptomCauseAction
Have S3 permission, but reading an SSE-KMS object is deniedThe role lacks kms:Decrypt or the key policy does not allow itAdd it to the key policy and IAM policy
Denied even though the IAM policy grants KMS permissionThe key policy lacks the statement delegating to the account's IAMAllow directly in the key policy or add the delegation statement
KMS throttling or a charge spike while processing many objectsA KMS call per objectS3 Bucket Key
Some access is denied after turning on the bucket keyA condition on an encryption context based on the object ARNChange it to use the bucket ARN
Cross-account sharing fails at decryptionEncrypted with an AWS managed key, or the key policy is missingCustomer managed key + allow the other account in the key policy
Changed default encryption but old objects are unchangedDefault encryption applies only to new objectsRe-encrypt by copying
A Glue job in a VPC times out on KMSNo path to KMSKMS VPC endpoint
SSE-C upload to a new bucket returns 403New buckets block SSE-C by defaultAllow it in the bucket encryption settings

Clue in the Question → Answer Lookup

Clue in the questionAnswer
"Audit key usage and control access directly"SSE-KMS + customer managed key
"Ease SSE-KMS's KMS cost and throttling, keep key control"S3 Bucket Key
"AWS must never see the plaintext"Client-side encryption
"A regulation requiring two layers of encryption"DSSE-KMS
"Block plaintext HTTP access"Deny when aws:SecureTransport is false
"Force Redshift connections to be encrypted"require_ssl
"Encrypt a Glue job's output, logs, and bookmarks all at once"Glue security configuration
"Another account must read the encrypted data"Allow the other account in the key policy of a customer managed key
"Don't delete the key by mistake"Disable instead of delete, deletion waiting period

Tomorrow we cover the problems that encryption and permissions alone can't stop: finding where sensitive data lives (Macie) and reducing exposure (masking and tokenization).

📖 Glossary

  • KMS key: The top-level key that stays inside KMS and wraps data keys. The same thing as a CMK in older material.
  • Data key: The key that encrypts the actual data. It is stored next to the data in a form encrypted by the KMS key.
  • Envelope encryption: A two-tier structure where data is encrypted with a data key and the data key is encrypted with a KMS key.
  • Key policy: A resource-based policy attached to a KMS key. It determines who can use and manage the key.
  • Grant: A way to delegate only some operations of a key to a specific principal. Mostly created when an AWS service uses the key on your behalf.
  • S3 Bucket Key: A bucket-level key that S3 obtains from KMS and holds briefly to generate per-object data keys. It reduces KMS calls.
  • Encryption context: Additional information bound in when encrypting. The same value must be present when decrypting, and it can also be used as a policy condition.
  • SSE: Server-side encryption. The service encrypts the data after receiving it and before storing it.
  • Security configuration: A setting that bundles the encryption methods for the S3 data, logs, and bookmarks a Glue job uses.
  • Key rotation: Creating new key material for encryption while leaving the key ID unchanged.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

You encrypt a large number of S3 objects with SSE-KMS, and the KMS API call cost and throttling have become a problem. What is the most appropriate way to reduce the cost and calls?

Question 2

A regulation requires you to guarantee that AWS can never see the plaintext of the data. Which encryption method is the most suitable?

Question 3

The S3 data is encrypted with SSE-KMS, but a security review flagged that plaintext HTTP access is possible. What action protects data in transit?

Question 4

A Glue ETL job cannot read S3 data encrypted with SSE-KMS and gets a permission error. The Glue job role ARN is not in the key policy. What is the correct fix?

Question 5

Which statement most accurately describes KMS envelope encryption?

PreviousAccess Control: IAM and Lake Formation PermissionsWeek 9 · Day 1Next Protecting Sensitive Data: Macie and MaskingWeek 9 · Day 3

Official references

  • DEA-C01 official exam page(opens in a new tab)
  • AWS KMS documentation(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)
  • AWS Glue documentation(opens in a new tab)
  • AWS IAM documentation(opens in a new tab)
  • Amazon Redshift documentation(opens in a new tab)

On this page

  • Key Takeaways
  • The Three Kinds of KMS Keys
  • How Envelope Encryption Actually Works
  • Key Policy: The Center of KMS Access
  • Rotation and Deletion
  • Five Ways to Encrypt S3 at Rest
  • How S3 Bucket Key Works and Its Side Effects
  • Where to Configure Encryption per Service
  • Encryption in Transit
  • Client-Side Encryption
  • Symptom → Cause → Action
  • Clue in the Question → Answer Lookup
  • Glossary
  • Practice Questions