I made a typo while creating an IAM role to allow a lambda function to access the cloudwatch logs and to create EC2 volumes snapshots. Is there any way to rename the role, whether by using the console or the AWS CLI ?
Within your account, a friendly name for a user, user group, role, or policy must be unique.
You can change the name of an AWS account in the AWS Billing and Management console. Note: Only the AWS account root user can modify the AWS account name. For more information, see Tasks that require root user credentials. Sign in to the AWS account that you want to modify using your root user credentials.
One way to approach it is to duplicate the existing role along with all its policies, make the needed change on the new role and run your tests. There's no aws iam copy-role command though... So your only option is to duplicate the role and its associated policies manually or to script the process.
You cannot edit IAM roles after the role has been created. This is mentioned in several places, including when the role is created through the IAM console.
And in several places in the docs.
For Role name, type a role name to help identify the purpose of this role. Role names must be unique within your AWS account. After you enter the name, click Next Step.
Role names have character limitations. The number of roles in an AWS account and the policy size for policies attached to roles are also limited. For more information, see Limitations on IAM Entities and Objects. Note that you cannot edit the name of the role after it is created.
It is not possible to edit the name via the console or AWS CLI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With