To allow your account to assume the service role you'll need to edit the role and add your account in the Principal
. To do so:
In IAM
-> Roles
-> Your Service Role
go to the Trust relationship
tab and click on Edit trust relationship
. Your trust relationship will something like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
You need to add your AWS account similar to this:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com",
"AWS": "arn:aws:iam::<your AWS account number>:root"
},
"Action": "sts:AssumeRole"
}
]
}
You will then be able to get credentials through sts
.
Another way to get the desired outcome you're seeking is to use Policy Simulator
In the role's Permissions
tab, click the arrow to the left of the policy and it will display a button to Simulate policy
:

NOTE
It's not possible to use an IAM Group as a Principal
.
Note that a group is not truly an identity because it cannot be identified as a Principal in a resource-based or trust policy. It is only a way to attach policies to multiple users at one time.
References