A developer is configuring an application running on an Amazon EC2 instance in Account A () to write logs to an Amazon S3 bucket in Account B () by assuming an IAM role. The EC2 instance is associated with an IAM instance profile containing a role named `AppEngineRole`. In Account B, the developer has created an IAM role named `LogWriterRole` with a permissions policy allowing `s3:PutObject` on the S3 bucket.
Currently, the application fails to write logs and receives an `AccessDenied` error. The developer reviews the existing configurations:
Account A - `AppEngineRole` Permissions Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::account-b-logs-bucket/*"
}
]
}
Account B - `LogWriterRole` Trust Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Which of the following changes must the developer make to resolve the error and allow the application to assume the role and write to the S3 bucket? (Select TWO.)
- Modify the permissions policy of `AppEngineRole` in Account A to allow the `sts:AssumeRole` action on `arn:aws:iam::444455556666:role/LogWriterRole`.Answer
- Modify the trust policy of `LogWriterRole` in Account B to specify the principal `"AWS": "arn:aws:iam::111122223333:role/AppEngineRole"` instead of the EC2 service principal.Answer
- CModify the trust policy of `LogWriterRole` in Account B to specify the principal `"AWS": "arn:aws:iam::111122223333:instance-profile/AppEngineRole"`.
- DModify the permissions policy of `AppEngineRole` in Account A to grant `s3:PutObject` permissions on the S3 bucket in Account B.
- EUpdate the application code to initialize the AWS SDK client using credentials retrieved by calling the Instance Metadata Service (IMDS) directly for the assumed role.