AWS Identity and Access Management
CLI Reference (API Version 2010-05-08)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

iam-groupdel

Description

Deletes a group from your AWS account. If using this command only with the -g option, the group must be empty and have no attached policies.

If you want to delete the group, delete the users from the group, and delete its attached policies all at once, you can use the -r option to recursively delete the group. Recursively deleting the group automatically removes user associations from the group and deletes any attached policies along with the group.

Important

Use the -r option with caution. Before performing a recursive delete, to ensure you are not deleting anything you don't want to, use the -p option along with the -r option to list all the users in the group and any attached policies without actually performing the recursive deletion.

Syntax

iam-groupdel -g GROUPNAME [ -r [-p] ]

Options

Name Description Required

-g GROUPNAME

Name of the group to delete.

Type: String

Default: None

Yes

-r

Removes any users from the group and deletes any attached policies while deleting the group.

Type: String

Default: None

Optional

-r -p

Returns a list of associated users and policies, without actually deleting the group. Use this before using -r to ensure you are not deleting anything you don't want deleted. The -p option indicates pretend mode; use only with the -r option.

Type: String

Constraints: You can apply -p only together with -r.

Default: None

Optional

Output

If the deletion is successful, the output is empty.

Examples

The following example deletes the group called Test. This example assumes the group is empty and has no policies attached.

PROMPT> iam-groupdel -g Test

The following example shows the user associations and the policies that would be deleted if you were to recursively delete the Test group.

PROMPT> iam-groupdel -g Test -r -p
users
     arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Susan
     arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/John
policies
     TestGroupPolicy

The following example recursively deletes the Test group.

PROMPT> iam-groupdel -g Test -r