A developer is implementing a security strategy for an application. The application needs to retrieve a database password and also encrypt application audit logs (average size ) locally before archiving them to Amazon S3. The database password requires automatic rotation. The audit logs must be encrypted client-side using a customer managed key (KMS key) in AWS KMS. Which combination of services and KMS operations should the developer use to meet these requirements?
- Store the database password in AWS Secrets Manager to enable automatic rotation. For the audit logs, call GenerateDataKey to obtain a plaintext data key and an encrypted data key, encrypt the logs locally with the plaintext key, and store the encrypted data key alongside the encrypted logs in S3.Answer
- BStore the database password in Systems Manager Parameter Store to enable automatic rotation. For the audit logs, call Encrypt to encrypt the logs directly using the customer managed key before uploading them to S3.
- CStore the database password in AWS Secrets Manager. For the audit logs, call Decrypt to retrieve the plaintext customer managed key, encrypt the logs locally with the customer managed key, and upload them to S3.
- DStore the database password in AWS Secrets Manager. For the audit logs, call GenerateDataKeyWithoutPlaintext to obtain an encrypted data key, encrypt the logs locally using the encrypted data key, and upload them to S3.
Answer
Store the database password in AWS Secrets Manager to enable automatic rotation. For the audit logs, call GenerateDataKey to obtain a plaintext data key and an encrypted data key, encrypt the logs locally with the plaintext key, and store the encrypted data key alongside the encrypted logs in S3.
The correct approach uses AWS Secrets Manager for the database password because it provides out-of-the-box automatic rotation. For the audit logs, since the payload size () exceeds the limit of the KMS Encrypt API, the application must use envelope encryption. The GenerateDataKey API returns both the plaintext data key (used to encrypt the file locally) and the ciphertext data key (stored alongside the encrypted logs for future decryption).
Step-by-Step Solution
Key Concept
AWS KMS Envelope Encryption and Secrets Management
Estimated Time:1m 30s