A developer is deploying a Go application to run in an Amazon ECS task using the AWS Fargate launch type. The application uses the AWS SDK to retrieve configuration data from Amazon Systems Manager Parameter Store. The developer wants to ensure that the application can authenticate with AWS services securely during local development and in the production ECS environment without code modifications. Which two actions should the developer take to configure the credential retrieval process correctly? (Select TWO.)
- Initialize the AWS SDK client using the default credential provider chain configuration without passing any static credentials.Cevap
- Associate an IAM role containing the required permissions with the ECS task definition using the taskRoleArn parameter.Cevap
- CHardcode the AWS Access Key ID and Secret Access Key in the SDK client configuration for local testing, and use container environment variables to pass them in production.
- DConfigure the trust policy of the IAM role to allow the ecs.amazonaws.com service principal to assume the role.
- EStore the credentials in Systems Manager Parameter Store and configure automatic rotation, since Parameter Store natively supports credential rotation like AWS Secrets Manager.
Cevap
Initialize the AWS SDK client using the default credential provider chain configuration without passing any static credentials, and associate an IAM role containing the required permissions with the ECS task definition using the taskRoleArn parameter.
To authenticate securely without code changes across environments, the developer should initialize the AWS SDK client using the default credential provider chain. The chain automatically searches for credentials in the environment, local configuration files (during local development), and container credentials (ECS Task Roles) when deployed on AWS. The IAM role containing the permissions must be associated with the ECS task definition using the taskRoleArn parameter, allowing the application within the container to retrieve temporary security credentials.
Adım Adım Çözüm
Anahtar Kavram
AWS SDK Default Credential Provider Chain and ECS Task Roles
Tahmini Süre:1m 30s