A microservice running on AWS Lambda needs to perform local client-side envelope encryption on application log files that range from MB to MB in size before storing them in an on-premises archive. The microservice must use a customer managed key in AWS KMS.
Which of the following configuration and SDK coding steps should the developer perform to implement this securely with minimum privilege? (Select TWO.)
- Call the `GenerateDataKey` API operation in the application code, using the plaintext data key to encrypt the log file locally, and discard the plaintext key from memory immediately after encryption.Answer
- Add `kms:GenerateDataKey` permissions to the Lambda function's IAM execution role for the specific ARN of the customer managed key.Answer
- CCall the `Encrypt` API operation in the application code, passing the raw log file as the plaintext parameter to be encrypted directly by KMS.
- DCall the `GenerateDataKeyWithoutPlaintext` API operation in the application code to retrieve the ciphertext data key, then use the Lambda function's default environment variables to decrypt it.
- EGrant `kms:Decrypt` and `kms:GenerateDataKey` permissions on the AWS managed key `aws/s3` to the Lambda execution role.
Answer
To implement local client-side envelope encryption for large files with minimum privilege, the developer must call `GenerateDataKey` in the application code to obtain the plaintext and ciphertext data keys, and grant `kms:GenerateDataKey` permissions on the customer managed key to the Lambda execution role.
For files larger than KB, local client-side envelope encryption must be utilized. Calling the `GenerateDataKey` API operation provides the plaintext key required to encrypt the logs locally and the ciphertext key to store along with the encrypted logs. The Lambda execution role must be granted permissions to execute `kms:GenerateDataKey` on the specific customer managed key's ARN to adhere to the principle of least privilege.
Step-by-Step Solution
Key Concept
AWS KMS Envelope Encryption Workflow and IAM Permissions
Estimated Time:2m 0s