A developer is writing a backup utility that must encrypt database export files, each approximately in size, before uploading them to an Amazon S3 bucket. The utility must use client-side envelope encryption with an AWS Key Management Service (AWS KMS) customer managed key.
Which two steps must the developer implement in the utility's code to encrypt the files securely and prepare them for storage?
- Call the AWS KMS GenerateDataKey API operation by passing the customer managed key identifier to obtain both a plaintext data key and a ciphertext data key.Answer
- Encrypt the database export file locally using the plaintext data key with a symmetric encryption algorithm, and then delete the plaintext data key from memory.Answer
- CCall the AWS KMS Encrypt API operation by passing the database export file and the customer managed key identifier to obtain the encrypted ciphertext.
- DCall the AWS KMS GenerateDataKeyWithoutPlaintext API operation to obtain the encrypted data key, and then call the AWS KMS Decrypt API operation to retrieve the plaintext data key.
- EStore the plaintext data key in AWS Systems Manager Parameter Store as a SecureString parameter, and upload the encrypted database export file to the S3 bucket.
Answer
Call the AWS KMS GenerateDataKey API operation by passing the customer managed key identifier to obtain both a plaintext data key and a ciphertext data key, and encrypt the database export file locally using the plaintext data key with a symmetric encryption algorithm, and then delete the plaintext data key from memory.
The correct answer combines calling the AWS KMS GenerateDataKey API to retrieve both key formats and performing the symmetric encryption locally before deleting the plaintext key from memory. Since the database export file is , direct encryption via the AWS KMS Encrypt API is impossible due to its payload limit. Locally encrypting with the plaintext data key and then immediately destroying it ensures maximum security.
Step-by-Step Solution
Key Concept
AWS KMS client-side envelope encryption workflow and payload limits