AWS Certified Developer – Associate — Question 281

A company is using Amazon OpenSearch Service to implement an audit monitoring system. A developer needs to create an AWS CloudFormation custom resource that is associated with an AWS Lambda function to configure the OpenSearch Service domain. The Lambda function must access the OpenSearch Service domain by using OpenSearch Service internal master user credentials.

What is the MOST secure way to pass these credentials to the Lambda function?

Answer options

Correct answer: D

Explanation

AWS Secrets Manager is the industry-standard and most secure service for managing database and service credentials, supporting automatic rotation and fine-grained IAM permissions. Using CloudFormation dynamic references ensures that sensitive credentials are never exposed in plaintext in CloudFormation templates, console outputs, or drift detection. Retrieving the secret dynamically at runtime using an IAM role with secretsmanager:GetSecretValue is significantly more secure than storing credentials in environment variables or using less-specialized storage systems.