A developer is migrating a Python application from an Amazon EC2 instance to an Amazon EKS cluster. The application uses the AWS SDK for Python (Boto3) to access an Amazon DynamoDB table. On the EC2 instance, the application successfully used the instance profile credentials. In the EKS cluster, the application fails to authenticate, resulting in a NoCredentialsError.
The EKS ServiceAccount has been annotated with the role ARN arn:aws:iam::123456789012:role/my-dynamodb-role, and the environment variables AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE are correctly injected into the container. However, the application code initializes the client using boto3.Session(aws_access_key_id=access_key, aws_secret_access_key=secret_key) where the keys are read from a configuration file that is not present on EKS.
Which two changes should the developer make to resolve this authentication issue and securely run the application on EKS? (Select two.)
- Modify the Python code to initialize the Boto3 client using the default session: boto3.client('dynamodb').Answer
- Configure the IAM role's trust policy to trust the EKS cluster's OIDC provider and allow the sts:AssumeRoleWithWebIdentity action.Answer
- CModify the IAM role's trust policy to trust the eks.amazonaws.com service principal and allow the sts:AssumeRole action.
- DUpdate the Python code to manually parse the web identity token file, call the sts:AssumeRole API, and configure static credentials in the Boto3 client constructor.
- EConfigure AWS Systems Manager Parameter Store to store the IAM role's temporary credentials and retrieve them using the Boto3 client on application startup.