Bobcares

wesupport

CLIENT AREACall Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Not authorized to perform iam:PassRole error – How to resolve

by | Jun 11, 2021

Wondering how to resolve “Not authorized to perform iam:PassRole” error? We can help you.

At Bobcares we assist our customers with several AWS queries as part of our AWS Support Services for AWS users, and online service providers.

Today, let us discuss how our Support Techs resolved above error.

 

Not authorized to perform iam:PassRole error

Typical error looks as shown below:

ClientError: An error occurred (AccessDenied) when calling the PutLifecycleHook operation: User: arn:aws:sts::111122223333:assumed-role/Testrole/Diego is not authorized to perform: iam:PassRole on resource: arn:aws:iam::111122223333:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling

When you create a service-linked role, you must have permission to pass that role to the service.

Some services automatically create a service-linked role in your account when you perform an action in that service.

For example, Amazon EC2 Auto Scaling creates the AWSServiceRoleForAutoScaling service-linked role for you the first time that you create an Auto Scaling group.

If you try to create an Auto Scaling group without the PassRole permission, you receive the above error.

To fix this error, the administrator need to add the iam:PassRole permission for user.

 

How to resolve “not authorized to perform iam:PassRole” error?

In order to pass a role to an AWS service, a user must have permissions to pass the role to the service.

To allow a user to pass a role to an AWS service, you must grant the PassRole permission to the user’s IAM user, role, or group.

A user can pass a role ARN as a parameter in any API operation that uses the role to assign permissions to the service.

The service then checks whether that user has the iam:PassRole permission.

In order to grant a user the ability to pass any of an approved set of roles to the Amazon EC2 service upon launching an instance.

You need three elements:

  • Firstly, an IAM permissions policy attached to the role that determines what the role can do.

Scope permissions to only the actions that the role must perform, and to only the resources that the role needs for those actions.

You can use AWS managed or customer-created IAM permissions policy.

{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": [ "A list of the permissions the role is allowed to use" ], "Resource": [ "A list of the resources the role is allowed to access" ] } }
  • A trust policy for the role that allows the service to assume the role.

For example, you could attach the following trust policy to the role with the UpdateAssumeRolePolicy action.

This trust policy allows Amazon EC2 to use the role and the permissions attached to the role.

{
"Version": "2012-10-17",
"Statement": {
"Sid": "TrustPolicyStatementThatAllowsEC2ServiceToAssumeTheAttachedRole",
"Effect": "Allow",
"Principal": { "Service": "ec2.amazonaws.com" },
"Action": "sts:AssumeRole"
}
}
  • An IAM permissions policy attached to the IAM user that allows the user to pass only those roles that are approved.

iam:PassRole usually is accompanied by iam:GetRole so that the user can get the details of the role to be passed.

Please find the example below.

{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PassRole"
],
"Resource": "arn:aws:iam::<account-id>:role/EC2-roles-for-XYZ-*" }] }

Now the user can start an Amazon EC2 instance with an assigned role.

The permissions policies attached to the role determine what the instance can do.

[Need help with AWS error? We’d be happy to assist]

 

Conclusion

In short, this error occurs when you try to create an Auto Scaling group without the PassRole permission. Today we saw the steps followed by our Support Techs to resolve it.

 

Are you using Docker based apps?

There are proven ways to get even more out of your Docker containers! Let us help you.

Spend your time in growing business and we will take care of Docker Infrastructure for you.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags