In this guide, we'll go over various options to allow the AWSLabsUser in AWS to attach policies to roles, including both predefined and custom policies.
When trying to attach a policy to a role, the action iam:AttachRolePolicy fails because there is no existing identity-based policy allowing this action for AWSLabsUser. This guide provides different options for granting this permission.

The IAMFullAccess managed policy grants full permissions over IAM resources, including the ability to manage users, roles, policies, and groups.
- Go to the IAM console.
- Attach the
IAMFullAccesspolicy to theAWSLabsUseruser.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iam:*",
"Resource": "*"
}
]
}
The PowerUserAccess policy provides broad administrative access except for IAM management. You can attach this policy along with a custom policy to allow only specific IAM actions, such as attaching policies to roles.
- Attach
PowerUserAccessto theAWSLabsUser. - Create a custom policy allowing
iam:AttachRolePolicyfor specific roles.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iam:AttachRolePolicy",
"Resource": "arn:aws:iam::<AccountID>:role/TargetRoleName"
}
]
}
If you need AWSLabsUser to attach policies across accounts, you can use a combination of permissions and trust policies.
- In the Source Account: Attach a policy to
AWSLabsUserallowingsts:AssumeRoleon the target account role. - In the Target Account: Modify the role’s trust policy to allow
AWSLabsUserto assume it.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::<TargetAccountID>:role/TargetRoleName"
}
]
}