A developer is configuring a third-party SaaS monitoring application to collect performance metrics from Amazon EC2 instances in their AWS account. The SaaS vendor's application runs in AWS account 123456789012. The vendor requires a secure delegation mechanism using an external ID value of VendorTokenXYZ.
The developer creates an IAM role named SaaSMonitoringRole with the following trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:root"
},
"Action": "sts:AssumeRole"
}
]
}
And attaches the following permissions policy to the role:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:Describe*",
"Resource": "*",
"Condition": {
"StringEquals": {
"sts:ExternalId": "VendorTokenXYZ"
}
}
}
]
}
However, the third-party application is unable to retrieve the EC2 metrics. Which of the following changes will resolve the authorization issue and follow security best practices?
- Move the sts:ExternalId condition block from the permissions policy to the condition block of the trust policy.Cevap
- BAdd the Principal element directly to the permissions policy and declare the third-party AWS account ID within it.
- CModify the trust policy to change the allowed action from sts:AssumeRole to sts:AssumeRoleWithWebIdentity.
- DCreate an IAM user with administrative permissions, generate access keys, and configure the third-party application to use these long-term credentials.