AWS Key Management Service (KMS) is a fully managed encryption service that allows you to create, manage, and control cryptographic keys used to secure your data. KMS integrates seamlessly with many AWS services, ensuring strong encryption at rest and in transit, while aligning with compliance requirements like HIPAA.
- Centralized Key Management: Manage cryptographic keys securely with granular access controls.
- Integration with AWS Services: Works with services such as EBS, S3, RDS, and more for seamless encryption.
- CloudTrail Integration: Enables auditing of key usage and access attempts.
- Flexible API: Encrypt, decrypt, and manage keys programmatically using AWS SDK or CLI.
- Never Exposes Plaintext Keys: All operations involving cryptographic keys are securely handled within AWS.
- Symmetric Keys:
- AES-256 keys for both encryption and decryption.
- Integrated with AWS services for most encryption use cases.
- Key is never directly accessible; operations must call the KMS API.
- Asymmetric Keys:
- RSA or ECC key pairs for encryption/decryption or digital signature verification.
- Public key is downloadable for use outside AWS, but private key remains secure.
- Use cases include cross-platform encryption where KMS API calls are impractical.
- AWS-Owned Keys:
- Managed entirely by AWS and used by default (e.g., SSE-S3, SSE-SQS).
- Free of charge.
- AWS-Managed Keys:
- Automatically created by AWS for specific services (e.g.,
aws/rds
,aws/ebs
). - Free of charge but limited to specific AWS services.
- Automatically rotated every year.
- Automatically created by AWS for specific services (e.g.,
- Customer-Managed Keys:
- Fully customizable and allows precise access control.
- $1 per month per key + API call charges.
- Can be configured for automatic or on-demand rotation.
- Supports features like cross-account access.
- Imported Keys:
- Bring your own keys to AWS for integration.
- $1 per month per key; rotation must be manual using an alias.
Key policies in KMS define access controls for KMS keys and are required to grant permissions. They function similarly to S3 bucket policies but are mandatory.
- Default Key Policy:
- Suitable for simple scenarios where only the account owner or administrators need access to the key and no cross-account sharing or detailed access restrictions are required
- Custom Key Policy:
- Allows granular control over access and administration.
- Necessary for enabling cross-account access or restricting specific operations.
KMS does not physically share keys across accounts. Instead, access to key usage is granted through policies.
To securely share encrypted data between AWS accounts:
- Create a Snapshot encrypted with your customer-managed key.
- Attach a Key Policy to allow access to the target account.
- Share the Snapshot with the target account.
- In the target account, copy the Snapshot, re-encrypting it with a key in that account.
- Create a Volume from the copied snapshot for use.
This process ensures that the encryption key remains within its originating account while enabling secure data sharing. The shared key is used for decryption when copying the snapshot.
AWS KMS provides robust security measures for key management:
- HIPAA Compliance: Aligns with encryption requirements.
- Encrypted Secrets: Never store sensitive data, such as passwords, in plaintext.
- Auditing: Use CloudTrail to track and monitor key usage.
- Encryption in AWS Services: KMS encrypts data for services like S3, EBS, and RDS.
- Secure API Operations: Use KMS APIs for encrypting and decrypting data programmatically.
- Cross-Account Sharing: Enable secure collaboration while keeping encryption keys within their source account.
- External Encryption: Utilize asymmetric keys for external systems that cannot directly access KMS APIs.
- Enable Key Rotation: Automatically rotate customer-managed keys for better security.
- Use IAM and Key Policies: Combine IAM roles and key policies for layered access control.
- Audit Regularly: Review CloudTrail logs to detect unauthorized access.
- Encrypt Secrets: Always encrypt sensitive information and never store plaintext secrets.