Soru

Zorluk: OrtaAWS SDKs and Credential Management

A developer is configuring a Java-based backend service that uses the AWS SDK to read objects from an Amazon S3 bucket. The service will be deployed to Amazon Elastic Container Service (ECS) on Amazon EC2 container instances. During testing, the developer wants to ensure that the SDK retrieves credentials securely using the default credential provider chain.

Which two credential sources are checked by the default credential provider chain before it attempts to retrieve credentials from the Amazon EC2 Instance Metadata Service (IMDS)?

  1. Environment variables such as `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`Cevap
  2. The shared credentials file (typically located at `~/.aws/credentials` on the host)Cevap
  3. C
    The credentials associated with the Amazon ECS Task Execution Role
  4. D
    An encrypted parameter stored in Systems Manager Parameter Store containing the access keys
  5. E
    Hardcoded credentials specified directly within the Java code when instantiating the S3 client

Cevap

The default credential provider chain resolves environment variables and the shared credentials file before checking the Amazon EC2 Instance Metadata Service.
The default credential provider chain checks environment variables (like `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) first, and subsequently checks the shared credentials file (usually at `~/.aws/credentials`). Both of these checks occur before the SDK attempts to query the Amazon EC2 Instance Metadata Service (IMDS) for instance profile credentials.

Adım Adım Çözüm

1
Analyze client initialization
The client is created using default settings
Allows the default credential provider chain to resolve credentials automatically
2
Trace the default credential provider chain precedence
The chain searches environment variables, system properties, web identity tokens, and the shared credentials file before instance metadata
Determines which sources are checked before the EC2 Instance Metadata Service
3
Match correct locations to the options
Environment variables and the shared credentials file are correct
Identifies the correct choices from the five options

Anahtar Kavram

AWS SDK Default Credential Provider Chain Order of Precedence
Tahmini Süre:1m 30s
Bu soruyu puanla