A developer is deploying an application on an Amazon EC2 instance that needs to read data from an Amazon DynamoDB table. The developer creates an IAM role to grant the application the required permissions. The developer wants to configure the trust policy for this IAM role.
Consider the following trust policy document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "<PLACEHOLDER>"
},
"Action": "sts:AssumeRole"
}
]
}
To allow the EC2 instance to assume this IAM role, which value should replace `<PLACEHOLDER>`?
- ec2.amazonaws.comCevap
- Bdynamodb.amazonaws.com
- Carn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess
- Darn:aws:iam::123456789012:user/app-credentials
Cevap
ec2.amazonaws.com
The correct answer is the option specifying the EC2 service principal. An IAM role's trust policy defines the principals (users, roles, accounts, or services) that are allowed to assume the role. Since the application is running on an Amazon EC2 instance, the EC2 service itself must be trusted to assume the role on behalf of the instance. The service principal for EC2 is ec2.amazonaws.com.
Adım Adım Çözüm
Anahtar Kavram
IAM role trust policies dictate which AWS services or identities can assume a role.
Tahmini Süre:45s