Soru

Zorluk: KolayAWS SDKs and Credential Management

A developer is configuring a local development workstation to run a Python script that uses the AWS SDK (Boto3) to upload files to Amazon S3. To adhere to security best practices, the developer must avoid hardcoding AWS credentials directly within the script. Which two methods should the developer use to securely provide the required credentials to the AWS SDK? (Select TWO.)

  1. Define the credentials as system environment variables named AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.Cevap
  2. Store the credentials under a profile in the shared AWS credentials file located at ~/.aws/credentials.Cevap
  3. C
    Initialize the S3 client constructor with the aws_access_key_id and aws_secret_access_key parameters as plaintext string values.
  4. D
    Save the credentials in a plaintext local configuration file named config.json in the application's root directory.
  5. E
    Configure an IAM Task Execution Role trust policy on the local operating system to grant access to S3 resources.

Cevap

Setting the credentials as environment variables or storing them in the shared AWS credentials file are the recommended secure methods.
The correct options are using system environment variables and using the shared AWS credentials file. The AWS SDK default credential provider chain automatically searches for environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) first, and then looks in the shared credentials file (located at ~/.aws/credentials). Both methods allow the code to run securely without hardcoding sensitive access keys.

Adım Adım Çözüm

1
Identify the standard mechanism by which the AWS SDK retrieves credentials without code modification.
The AWS SDK implements the Default Credential Provider Chain, which looks for credentials in environment variables and local shared credential files.
Understanding the SDK's credential search sequence is essential for secure local configuration.
2
Select options that conform to the default credential chain without exposing secrets in code.
Defining environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) and using the local shared credentials file (~/.aws/credentials) both satisfy this requirement.
These mechanisms keep sensitive keys outside the application files.

Anahtar Kavram

AWS SDK Default Credential Provider Chain for Local Development
Tahmini Süre:1m 0s
Bu soruyu puanla