SAP-C02 exam dumps

SAP-C02 practice question 245 of 678

AWS Certified Solutions Architect - Professional. Professional level, Amazon Web Services. Free question with the correct answer and a full explanation.

SAP-C02 Question 245

Single answer

Your company is building a serverless web application on AWS. To securely access data in an Amazon DynamoDB table, the application code running in AWS Lambda functions requires temporary credentials. As a Solutions Architect, you need to recommend a solution that adheres to the principle of least privilege and avoids hardcoding credentials. Which solution should you choose?

  1. A

    Create an IAM user with DynamoDB permissions, generate access keys, and configure them in Lambda environment variables.

  2. B

    Use an IAM role with a policy granting access to the DynamoDB table and attach the role to the Lambda function.

  3. C

    Store the DynamoDB access keys in AWS Secrets Manager and retrieve them from the Lambda function at runtime.

  4. D

    Assign full administrative privileges to all IAM roles used by the Lambda functions to ensure access to the DynamoDB table.

Show answer and explanation

Correct answer: B

Explanation

The recommended solution is to use an IAM role with a policy that grants specific permissions for accessing the DynamoDB table. By attaching the role to the Lambda function, AWS automatically provides the temporary credentials needed at runtime. This approach eliminates the need to manage credentials manually, adheres to the principle of least privilege, and ensures secure and scalable access to AWS resources.

  • A. Incorrect.

    Hardcoding access keys in Lambda environment variables goes against AWS best practices for security. This approach is insecure and does not scale well.

  • B. Correct.

    Using an IAM role with appropriate permissions and attaching it to the Lambda function is the recommended approach. It provides temporary credentials automatically managed by AWS and adheres to the principle of least privilege.

  • C. Incorrect.

    While AWS Secrets Manager is a secure way to store and retrieve sensitive information, it should not be used for storing IAM access keys, as it still involves hardcoding credentials. Instead, IAM roles should be used.

  • D. Incorrect.

    Assigning full administrative privileges violates the principle of least privilege and unnecessarily increases the attack surface of the application.

Timed practice exam

Take a SAP-C02 practice test under exam conditions

75 questions in 180 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam