AWS Key Management Service(KMS)
AWS Key Management Service (KMS) is a fully managed service that enables us to create and control encryption keys used to protect your data across AWS services and applications.
- Why use KMS?
- Key Features
- List of Encryptions
- Symmetric vs. Asymmetric Encryption
- KMS Key Deletion
- Server-Side Encryption (SSE) in AWS
- Allowing users in other accounts to use a KMS key
- Question: Key Policy Modifying External Accounts
- Question: Customer managed key by using AWS KMS
Why use KMS?
- Security: Keys
never leaveAWS hardware. - Compliance: Meets many
compliancerequirements (FIPS 140-2,HIPAA, GDPR). - Simplicity: Integrates with AWS services out of the box.
Key Features
- Key Creation: Create symmetric or asymmetric keys, either customer managed or AWS managed.
- Encryption: Encrypt data directly or use envelope encryption (encrypting data keys).
- Integration: Works seamlessly with AWS services like S3, EBS, RDS, Lambda, and Redshift.
- Access Control: Control access using IAM policies and KMS key policies.
- Audit Logging: Monitor key usage through detailed logs in AWS CloudTrail.
- Automatic Rotation: Supports automatic key rotation every year for customer-managed keys (CMKs).
List of Encryptions
| Encryption Type | Description | AWS Use Cases / Services |
|---|---|---|
| Symmetric | Uses a single secret key for both encryption and decryption. Fast and efficient for large data. | S3 SSE-KMS, EBS, RDS encryption |
| Asymmetric | Uses a public-private key pair. Public key encrypts, private key decrypts. Slower, used for key exchange or signing. | IAM certificates, KMS for digital signing, TLS/SSL |
| Server-Side (SSE) | Encryption is handled by AWS after data is received (e.g., in S3, EBS). | S3 (SSE-S3, SSE-KMS, SSE-C), EBS, RDS |
| Client-Side (CSE) | Data is encrypted on the client before being uploaded to AWS. | S3 with AWS Encryption SDK or custom application logic |
| Encryption at Rest | Encrypts data stored on disk to prevent unauthorized access. | S3, EBS, RDS, DynamoDB encryption |
| Encryption in Transit | Encrypts data as it travels over networks (e.g., using TLS). | HTTPS, TLS-secured API calls, VPN |
| Envelope Encryption | Encrypts data keys with a master key (CMK), improving performance and security. | Used in SSE-KMS and CSE with KMS |
Symmetric vs. Asymmetric Encryption
- Symmetric Keys (default): Same key for encryption & decryption. This type of encryption is faster and better suited for bulk encryption.
- Asymmetric Keys: Key pair — public for encryption, private for decryption or signing. This type is slower, typically used for identity verification or key exchange.
KMS Key Deletion
- Destructive Action: Once deleted, a KMS key cannot be recovered.
- Waiting Period: Must be scheduled for deletion with a 7 to 30 days wait time (default: 30 days).
- During Waiting: Key status is
**PendingDeletion**. - Cancel Option: You can cancel deletion during the waiting period.
- After Waiting Period: Key is permanently deleted and unusable.
Server-Side Encryption (SSE) in AWS
Server-Side Encryption (SSE) is the process where AWS encrypts data at rest — after receiving it and before storing it — and decrypts it for authorized access, all handled on the server side by AWS.
AWS supports multiple types of server-side encryption, depending on the service and key management model.
- SSE with AWS-Owned Keys
- SSE with AWS KMS
- SSE-S3 (S3-Managed Keys)
- SSE-C (Customer-Provided Keys)
1. SSE with AWS-Owned Keys
- Fully managed AWS — customers don’t see, manage, or control the encryption keys.
- No key rotation, no access policies, and no audit logs for encryption key usage.
- Used by default in many AWS services like DynamoDB, RDS, EBS,Redshift.
- Encryption is automatic with zero configuration required.
- When to Use It?
- Require encryption at rest enabled with zero overhead
- Not require key management, auditing, and compliance controls.
- Ideal for internal apps or low-risk data
2. SSE-KMS (SSE with KMS)
- Encryption keys managed through AWS KMS.
- All key usage is logged in AWS CloudTrail for audit logs.
- Supports key rotation for CMKs (automatically if enabled).
- Additional charges for KMS API usage (e.g.,
Encrypt,Decrypt,GenerateDataKey). - Supported by AWS services like S3, EBS, RDS, DynamoDB, Redshift.
- Supports both subtypes:
- AWS-managed KMS keys - Created and fully managed by AWS for customer.
- Customer-managed CMKs - Created and controlled by customer in AWS KMS.
- When to Use It?
- Need compliance with regulations (e.g., HIPAA, PCI-DSS, FedRAMP).
- Require Auditing access to encryption keys.
- Need to centralize the control over key usage.
- Require automated or manual key rotation.
- Ideal for production systems, sensitive data, and enterprise security requirements.
3. SSE-S3 (SSE with S3-Managed Keys)
- Specific to Amazon S3.
- Amazon S3 encrypts each object using a unique key.
- These keys are encrypted with a master key that is regularly rotated.
- Key management is handled entirely by Amazon S3.
- Encryption algorithm: AES-256
- No extra cost beyond standard S3 storage.
- No key rotation or CloudTrail logging available.
- When to Use It?
- When require basic encryption at rest without managing keys or audit trails.
4. SSE-C (SSE with Customer-Provided Keys)
- Only available in S3.
- Customer provides the encryption key with each request (upload/download).
- AWS does not store or log the key.
- No CloudTrail integration, and you handle all key rotation/loss issues.
- When to Use It?
- When you want to fully control the encryption keys and not rely on AWS key storage.
Note:
- SSE-S3, SSE-KMS, and SSE-C are valid only within Amazon S3.
- For other AWS services, AWS-owned keys, or SSE with KMS (either AWS- or customer-managed keys) are used.
Question: Key Policy Modifying External Accounts
A company recently signed a contract with an AWS Managed Service Provider (MSP) Partner for help with an application migration initiative. A solutions architect needs ta share an Amazon Machine Image (AMI) from an existing AWS account with the MSP Partner's AWS account. The AMI is backed by Amazon Elastic Block Store (Amazon EBS) and uses an AWS Key Management Service (AWS KMS) customer managed key to encrypt EBS volume snapshots. What is the MOST secure way for the solutions architect to share the AMI with the MSP Partner's AWS account?
Modify the launchPermission property of the AMI. Share the AMI with the MSP Partner's AWS account only. Modify the key policy to allow the MSP Partner's AWS account to use the key.(Correct Ans)- Modify the launchPermission property of the AMI. Share the AMI with the MSP Partner's AWS account only. Modify the key policy to trust a new KMS key that is owned by the MSP Partner for encryption.
Explanation
To securely share an EBS-backed AMI encrypted with a customer-managed KMS key, required two steps -
- To Share the AMI, you must set the
launchPermissionof the AMI to allow the specific AWS account ID of the MSP partner. - Allow KMS key access: Since the EBS snapshot is encrypted with your customer-managed KMS key, you must
update the key policyto allow KMS key access to the MSP partner’s AWS account to use the key.
This enables them to launch instances from the AMI using the encrypted snapshot.
Why Option 2 is incorrect?
"Modify the launchPermission property... Modify the key policy to trust a new KMS key that is owned by the MSP Partner for encryption."
This suggests switching to a KMS key that the MSP owns, which is not how AMI sharing works. You can’t re-encrypt an existing EBS snapshot using a third-party KMS key within the original account.
Question: Customer managed key by using AWS KMS
A company stores sensitive data in Amazon S3 A solutions architect needs to create an encryption solution. The company needs to fully control the ability of users to create, rotate, and disable encryption keys with minimal effort for any data that must be encrypted.
Which solution will meet these requirements?
- Use default server-side encryption with Amazon S3 managed encryption keys (SSE-S3) to store the sensitive data
- Create a customer managed key by using AWS Key Management Service (AWS KMS). Use the new key to encrypt the S3 objects by using server-side encryption with AWS KMS keys (SSE-KMS). (
Correct Ans) - Create an AWS managed key by using AWS Key Management Service {AWS KMS) Use the new key to encrypt the S3 objects by using server-side encryption with AWS KMS keys (SSE-KMS).
- Download S3 objects to an Amazon EC2 instance. Encrypt the objects by using customer managed keys. Upload the encrypted objects back into Amazon S3.
Explanation:
The key requirement is: “Fully control the ability of users to create, rotate, and disable encryption keys.” Based on this level of control is only possible with customer managed KMS keys — not AWS managed keys or default S3-managed keys.
If key control (create, rotate, disable) is a requirement, customer managed keys with SSE-KMS is the best and most secure solution.