Question

Difficulty: EasyAWS SDKs and Credential Management

A developer is deploying a containerized application to AWS and wants to use the AWS SDK to interact with Amazon S3. To ensure security and flexibility across environments, the developer decides to use the Default Credential Provider Chain to locate AWS credentials.

Which two of the following locations or sources are checked by the Default Credential Provider Chain to obtain these credentials?

  1. Environment variables such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEYAnswer
  2. IAM role credentials retrieved from the Amazon EC2 instance metadata service (IMDS)Answer
  3. C
    Hardcoded credentials specified directly within the SDK client constructor code
  4. D
    A credentials file stored in a private Amazon S3 bucket configured in the application parameters
  5. E
    An encrypted parameter in AWS Systems Manager Parameter Store retrieved via an explicit API call

Answer

The correct options are the environment variables (such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) and the IAM role credentials retrieved from the Amazon EC2 instance metadata service (IMDS).
The default credential provider chain automatically searches several locations in a specific order to resolve credentials. Among these, it checks environment variables (such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) first, and if no credentials are found in earlier locations, it queries the instance metadata service (IMDS) for credentials associated with an IAM role.

Step-by-Step Solution

1
Analyze the request for AWS SDK credential resolution.
The developer is using the Default Credential Provider Chain to automatically locate credentials.
Understanding the default credential lookup order is essential to determine where the SDK looks automatically.
2
Evaluate the standard search order of the Default Credential Provider Chain.
The search order starts with environment variables, then checks system properties, then the local credentials file, then container credentials (if applicable), and finally instance metadata (IMDS).
This identifies environment variables and instance metadata as valid sources within the default chain.
3
Identify correct and incorrect choices based on standard SDK behavior.
Environment variables and IMDS are part of the default chain, while hardcoding, S3 storage, and Systems Manager Parameter Store require explicit configuration or custom code and are not part of the default chain.
This isolates the correct options and rejects the incorrect distractors.

Key Concept

AWS SDK Default Credential Provider Chain Search Order
Rate this question