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.)
- Define the credentials as system environment variables named AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.Cevap
- Store the credentials under a profile in the shared AWS credentials file located at ~/.aws/credentials.Cevap
- CInitialize the S3 client constructor with the aws_access_key_id and aws_secret_access_key parameters as plaintext string values.
- DSave the credentials in a plaintext local configuration file named config.json in the application's root directory.
- EConfigure 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
Anahtar Kavram
AWS SDK Default Credential Provider Chain for Local Development
Tahmini Süre:1m 0s