An application running on an Amazon EC2 instance is designed to fetch daily configuration files from a private Amazon S3 bucket. During deployment, the application throws an Access Denied exception when attempting to call the `s3:GetObject` API operation. The developer has attached a policy with the required S3 permissions to an IAM role called `S3ReaderRole`, which is associated with the instance profile. Upon inspecting the role's trust policy, the developer finds the following configuration:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Which of the following modifications should the developer make to resolve this access issue?
- AAdd a new statement to the S3ReaderRole's permissions policy that allows the sts:AssumeRole action for the ec2.amazonaws.com service principal.
- Modify the trust policy of the S3ReaderRole to change the service principal in the Principal block to ec2.amazonaws.com.Cevap
- CInitialize the S3 client in the Java application code using hardcoded AWS access keys belonging to an IAM user with S3 read access.
- DModify the S3ReaderRole's trust policy to change the Action element from sts:AssumeRole to s3:GetObject.