A Lambda function generates a 3 MB JSON file containing sensitive data and uploads it daily to S3. The developer must ensure the file is encrypted before uploading. Which change should the developer implement so the data is encrypted prior to the upload?
Choose an answer
Tap an option to check your answer.
Correct answer: Call the GenerateDataKey API, then use the returned data key to encrypt the file inside the Lambda function code before uploading..
Why this is the answer
The correct approach is to call the GenerateDataKey API. This API returns a plaintext data key and an encrypted copy of that key. The Lambda function then uses the plaintext data key to encrypt the 3 MB JSON file before uploading it to S3. This ensures the data is encrypted client-side, fulfilling the requirement of encryption prior to upload. The encrypted data key is stored alongside the encrypted data in S3, allowing for decryption later. Using the default AWS KMS key for S3 or an S3-managed key (SSE-S3) encrypts the data at rest on S3 servers, not before upload. While these options encrypt the data, they don't meet the "prior to upload" requirement. Simply calling GenerateDataKey without using the returned key for client-side encryption wouldn't encrypt the file before it leaves the Lambda function.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed