Managing IAM User Groups (Part 2)

 






To Read Part 1, please click here




Attaching a Policy to an IAM User Group

If you want to attach a customer managed policy (a policy with custom permissions that you create), you must first create the policy.

To attach a policy to a user group (console)

  1. Sign-in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
  2. Select the User groups and the group's name in the navigation pane.
  3. Choose the Permissions tab.
  4. Now you can Add permissions and then Attach policy.
  5. The Current permissions policies list shows the attached current policies. You can easily choose the names of the policies you want to attach from the list of Other permissions policies.
  6. Choose Attach policies.

To attach a policy to a user group (AWS CLI or AWS API)

You can do either of the following:
  1. AWS CLI: aws iam attach-group-policy.
  2. AWS API: AttachGroupPolicy.

Renaming an IAM User Group

If you change a user group's name or path, then,-
  1. Any of the policies attached to the user group under the new name.
  2. The user group retains all its users under the new name.
  3. The unique ID for the user group remains the same. 
To change the name of an IAM user group

You can perform any of the following:

  1. AWS Management Console- You can choose User Groups and then the group's name in the navigation pane.
  2. AWS CLI- aws iam update-group.
  3. AWS API- UpdateGroup.

Deleting an IAM User Group

If a user group is deleted in the AWS Management Console, the console automatically removes all the group members, detaches all the attached policies and deletes all the inline policies; whereas, for AWS CLI, Tools for Windows PowerShell, or AWS API, you have to remove the users in the group first in order to delete a user group.

Deleting an IAM User Group (Console)

It can be easily done via AWS Management Console.

To delete an IAM user group (console)

  1. Sign-in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
  2. Select the User groups in the navigation pane.
  3. Now, you have to select the user groups you want to delete from the list of the user groups.
  4. Choose Delete.
  5. Type the user group name (and then select Delete) in the confirmation box, if you want to remove a single user group. However, if multiple user groups are to be deleted, then, you have to type the number of the groups followed by the user groups and then Delete.

Deleting an IAM User Group (AWS CLI)

A user group can also be deleted via AWS CLI.

To delete an IAM user group (AWS CLI)

  1. Remove all the users from the user group via- aws iam get-group (for listing the users) and then aws iam remove-user-from-group (for removing a user).
  2. Delete all the inline policies embedded in the user group via- aws iam list-group-polices (for listing the user group's inline policies) and then aws iam delete-group-policy (to delete the inline policies).
  3. Now you have to detach all the managed policies attached to the user group via- aws iam list-attached-group-polices (for listing the user group's managed policies) and then aws iam detach-group-policy (to delete the managed policy).
  4. Finally, you can delete the user group via- aws iam delete-group.

Deleting an IAM User Group (AWS API)

A user group can also be deleted via AWS API.

To delete an IAM user group (AWS API)

  1. Remove all the users from the user group via- GetGroup (for listing the users) and then RemoveUserFromGroup (for removing a user).
  2. Delete all the inline policies embedded in the user group via- ListGroupPolicies (for listing the user group's inline policies) and then DeleteGroupPolicy (to delete the inline policies).
  3. Now you have to detach all the managed policies attached to the user group via- ListAttachedGroupPolices (for listing the user group's managed policies) and then DetachGroupPolicy (to delete the managed policy).
  4. Finally, you can delete the user group via- DeleteGroup.









To Read Part 1, please click here















































Comments

Popular posts from this blog

Deployment (Part 3)

Deployment (Part 1)

Project Resourcing (Part 2)