How to securely store an external API key in AWS Lambda with full KMS control?
Short answer
B Store the API key in AWS Lambda environment variables. Create an AWS KMS customer managed key to encrypt the API key.
Question
Key Takeaways
The question tests your knowledge of AWS KMS key types and Lambda encryption options; the key trap is preferring Parameter Store while ignoring the need for customer managed KMS keys with full control.
For securely storing an external API key in a serverless application, the community agrees using Lambda environment variables encrypted with a customer managed KMS key (Option B) best meets requirements for full control and visibility.
Common mistake: Choosing Option A (Parameter Store with the default AWS KMS key) is common because Parameter Store can store secrets, but it fails because the default AWS-managed key does not give full control over the KMS key.
Expert Analysis
Why the Answer Is Correct
Option B is correct because Lambda environment variables support encryption using AWS KMS, and you can choose a customer managed KMS key for full control. The requirement states the company needs full control over the KMS keys, which only a customer managed key provides. Storing the API key in Lambda environment variables is also a standard, secure pattern for serverless applications.
Why the Other Options Are Wrong
Option A uses Parameter Store, which can store secrets, but the default AWS-managed KMS key does not provide full control to the customer, violating the requirement. Option C storing the API key in a code repository is insecure and does not explain KMS key control. Option D uses DynamoDB, which is unnecessary and still uses AWS managed keys rather than customer managed keys. Only B combines the correct secret storage service with the required customer controlled KMS key.
Community Comment Notes
Comments from users confirm that B is the only answer that satisfies the full control requirement. One commenter specifically noted, 'The company needs to have full control over AWS KMS => customer managed key in AWS KMS.' Another linked the official Lambda documentation for environment variable encryption, which directly supports using customer managed keys. The unanimous vote (100% for B) reinforces the consensus.
Official Reference
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars-encryption.html
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-encryption
These links open the official vendor documentation in a new tab.
Exam Strategy
When a question explicitly mentions 'full control over AWS KMS keys', immediately think customer managed key. Look for the storage option that allows attaching a customer managed key—Lambda environment variables or Parameter Store with a customer managed key both work, but the option must specify the correct key type.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 5 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 5
-
KarBiswa 👍 6 Answered Bhttps://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-encryption:~:text=If%20you%20prefer,on%20the%20function.
-
Lucky4Life 👍 2 Answered BBy creating a customer managed key in AWS Key Management Service (KMS), you gain full control over the encryption process.
-
albert_kuo 👍 1 Answered BThe company needs to have full control over the AWS Key Management Service (AWS KMS) => customer managed key in AWS Key Management Service (KMS)
-
preachr 👍 1 Answered Bhttps://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars-encryption.html
-
65703c1 👍 1 Answered BB is the correct answer.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →