A developer is configuring a local workstation to run a script that uses the AWS SDK to retrieve files from Amazon S3. To adhere to security best practices and avoid hardcoding credentials within the application, which two locations can the developer use to store the credentials so they are automatically detected by the default credential provider chain? (Select TWO.)
- Environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)Answer
- The shared credentials file (typically located at ~/.aws/credentials on Linux/macOS)Answer
- CThe initialization parameters of the S3 client constructor as hardcoded string parameters
- DAn IAM trust policy document saved in a file named trust-policy.json in the application's root directory
- EAn encrypted parameter in Systems Manager Parameter Store named aws_credentials
Answer
The developer should store the credentials in environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) or in the shared credentials file (~/.aws/credentials).
The correct options are environment variables and the shared credentials file because both are standard, secure ways to supply credentials that the AWS SDK's default credential provider chain automatically evaluates during initialization.
Step-by-Step Solution
Key Concept
The default credential provider chain automatically searches standard locations (like environment variables and the shared credentials file) in a specific order to obtain AWS credentials, eliminating the need to hardcode sensitive keys.
Estimated Time:1m 0s