- A
Store the database password in AWS Secrets Manager and retrieve it from within the Lambda function code.
Why wrong: While AWS Secrets Manager provides secure storage and rotation of secrets, the approach still requires the Lambda function to retrieve a secret (the password) at runtime. Although the secret is not hardcoded, it is still stored externally and retrieved, which does not fully eliminate the credential. More importantly, AWS best practices for this scenario recommend IAM database authentication over secret management because IAM authentication avoids the need for any password altogether.
- B
Store the database password in AWS Systems Manager Parameter Store as a SecureString and retrieve it from within the Lambda function.
Why wrong: Similar to Secrets Manager, Parameter Store (SecureString) provides encrypted storage for the password, but the Lambda function still retrieves the password at runtime. This means a credential exists and is transmitted, albeit securely. The requirement explicitly states that credentials must never be stored in code or configuration, and while Parameter Store is a secure option, it does not go as far as eliminating the need for a stored credential. IAM database authentication is the more secure and recommended AWS best practice for this use case.
- C
Configure the Lambda function to use an IAM role with permissions to connect to the RDS database using IAM database authentication.
IAM database authentication allows the Lambda function to connect to the RDS database using an authentication token generated from the function's IAM role. No password or secret is stored anywhere in the function code, environment variables, or configuration files. This approach fully meets the security requirement and follows AWS best practices for securing database connections from AWS Lambda. It also provides the added benefit of centralized access control through IAM policies.
- D
Encrypt the database password using AWS KMS and hardcode the encrypted password in the Lambda function code.
Why wrong: Hardcoding any password, even an encrypted one, in the function code violates the requirement that credentials never be stored in code. Additionally, encrypting a password with KMS does not eliminate the need to manage the encrypted value, and it introduces operational complexity. This approach is not a security best practice and does not meet the stated requirement.
Quick Answer
The correct approach is to configure the Lambda function with an IAM role that uses IAM database authentication to connect to the RDS MySQL database. This method works because IAM database authentication replaces static credentials with a short-lived authentication token generated via AWS Signature Version 4, which the Lambda function uses as a password. Since the token is automatically rotated and never stored in code, environment variables, or configuration files, it directly satisfies the security team’s requirement for no embedded secrets. On the AWS Certified Cloud Practitioner CLF-C02 exam, this scenario tests your understanding of how IAM roles and database authentication integrate to enforce least-privilege access without credential management. A common trap is choosing Secrets Manager or Parameter Store, but those still require storing a reference or secret; IAM database authentication eliminates secrets entirely. Memory tip: think “IAM token, no secret kept” — the Lambda role generates the token on the fly, so there’s nothing to steal.
CLF-C02 Security and Compliance Practice Question
This CLF-C02 practice question tests your understanding of security and compliance. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A company is migrating a legacy application from an on-premises server to AWS Lambda. The Lambda function needs to connect to an Amazon RDS for MySQL database that stores sensitive customer data. The security team requires that database credentials are never stored in the function's code, environment variables, or configuration files. The solution must follow AWS best practices for securing database access. Which approach should the company use?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"best"Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
Clue:
"never"Why it matters: Absolute qualifier. True only if the statement has zero exceptions — be cautious of options that seem obvious but break down in edge cases.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
Configure the Lambda function to use an IAM role with permissions to connect to the RDS database using IAM database authentication.
Option C is correct because IAM database authentication eliminates the need to store any credentials in code, environment variables, or configuration files. The Lambda function assumes an IAM role that generates an authentication token using the AWS Signature Version 4 process, which is then used as a password to connect to the RDS MySQL database. This approach meets the security team's requirement and follows AWS best practices by leveraging short-term, rotated credentials without embedding secrets.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Store the database password in AWS Secrets Manager and retrieve it from within the Lambda function code.
Why it's wrong here
While AWS Secrets Manager provides secure storage and rotation of secrets, the approach still requires the Lambda function to retrieve a secret (the password) at runtime. Although the secret is not hardcoded, it is still stored externally and retrieved, which does not fully eliminate the credential. More importantly, AWS best practices for this scenario recommend IAM database authentication over secret management because IAM authentication avoids the need for any password altogether.
- ✗
Store the database password in AWS Systems Manager Parameter Store as a SecureString and retrieve it from within the Lambda function.
Why it's wrong here
Similar to Secrets Manager, Parameter Store (SecureString) provides encrypted storage for the password, but the Lambda function still retrieves the password at runtime. This means a credential exists and is transmitted, albeit securely. The requirement explicitly states that credentials must never be stored in code or configuration, and while Parameter Store is a secure option, it does not go as far as eliminating the need for a stored credential. IAM database authentication is the more secure and recommended AWS best practice for this use case.
- ✓
Configure the Lambda function to use an IAM role with permissions to connect to the RDS database using IAM database authentication.
Why this is correct
IAM database authentication allows the Lambda function to connect to the RDS database using an authentication token generated from the function's IAM role. No password or secret is stored anywhere in the function code, environment variables, or configuration files. This approach fully meets the security requirement and follows AWS best practices for securing database connections from AWS Lambda. It also provides the added benefit of centralized access control through IAM policies.
Clue confirmation
The clue words "best", "never" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
Encrypt the database password using AWS KMS and hardcode the encrypted password in the Lambda function code.
Why it's wrong here
Hardcoding any password, even an encrypted one, in the function code violates the requirement that credentials never be stored in code. Additionally, encrypting a password with KMS does not eliminate the need to manage the encrypted value, and it introduces operational complexity. This approach is not a security best practice and does not meet the stated requirement.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often assume Secrets Manager or Parameter Store are the only secure options, but the question explicitly requires that credentials are never stored anywhere, making IAM database authentication the only valid choice because it uses temporary tokens instead of stored secrets.
Trap categories for this question
Similar concept trap
Similar to Secrets Manager, Parameter Store (SecureString) provides encrypted storage for the password, but the Lambda function still retrieves the password at runtime. This means a credential exists and is transmitted, albeit securely. The requirement explicitly states that credentials must never be stored in code or configuration, and while Parameter Store is a secure option, it does not go as far as eliminating the need for a stored credential. IAM database authentication is the more secure and recommended AWS best practice for this use case.
Scenario analysis trap
While AWS Secrets Manager provides secure storage and rotation of secrets, the approach still requires the Lambda function to retrieve a secret (the password) at runtime. Although the secret is not hardcoded, it is still stored externally and retrieved, which does not fully eliminate the credential. More importantly, AWS best practices for this scenario recommend IAM database authentication over secret management because IAM authentication avoids the need for any password altogether.
Detailed technical explanation
How to think about this question
IAM database authentication for RDS MySQL uses the mysql client's --enable-cleartext-plugin and a token generated via the AWS CLI command `aws rds generate-db-auth-token`, which produces a temporary password valid for 15 minutes. The Lambda function must have an IAM policy with `rds-db:connect` permission for the specific database user, and the RDS instance must have the IAM DB authentication enabled. This approach integrates with AWS Secrets Manager for automatic rotation of the IAM database user's password, but the key point is that the Lambda function never stores or retrieves a static credential.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Security and Compliance — study guide chapter
Learn the concepts, then practise the questions
- →
Security and Compliance practice questions
Targeted practice on this topic area only
- →
All CLF-C02 questions
1,024 questions across all exam domains
- →
AWS Certified Cloud Practitioner CLF-C02 study guide
Full concept coverage aligned to exam objectives
- →
CLF-C02 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related CLF-C02 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Cloud Concepts practice questions
Practise CLF-C02 questions linked to Cloud Concepts.
Security and Compliance practice questions
Practise CLF-C02 questions linked to Security and Compliance.
Cloud Technology and Services practice questions
Practise CLF-C02 questions linked to Cloud Technology and Services.
Billing, Pricing, and Support practice questions
Practise CLF-C02 questions linked to Billing, Pricing, and Support.
AWS shared responsibility model practice questions
Practise CLF-C02 questions linked to AWS shared responsibility model.
AWS IAM practice questions
Practise CLF-C02 questions linked to AWS IAM.
AWS pricing practice questions
Practise CLF-C02 questions linked to AWS pricing.
AWS support plans practice questions
Practise CLF-C02 questions linked to AWS support plans.
AWS S3 practice questions
Practise CLF-C02 questions linked to AWS S3.
AWS EC2 practice questions
Practise CLF-C02 questions linked to AWS EC2.
Practice this exam
Start a free CLF-C02 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this CLF-C02 question test?
Security and Compliance — This question tests Security and Compliance — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Configure the Lambda function to use an IAM role with permissions to connect to the RDS database using IAM database authentication. — Option C is correct because IAM database authentication eliminates the need to store any credentials in code, environment variables, or configuration files. The Lambda function assumes an IAM role that generates an authentication token using the AWS Signature Version 4 process, which is then used as a password to connect to the RDS MySQL database. This approach meets the security team's requirement and follows AWS best practices by leveraging short-term, rotated credentials without embedding secrets.
What should I do if I get this CLF-C02 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "best", "never". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
This CLF-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CLF-C02 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.