| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Deletes a role from your AWS account. You must remove any attached policies from the role before you can delete it.
To delete a role recursively, use the -c option. Recursively
deleting the role automatically deletes the associated instance profile and role policies.
Important
Use the -c 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 -c
option to list all the role's associated instance profiles without actually performing the
recursive deletion.
Caution
Make sure you do not have any Amazon EC2 instances running with the role or instance profile you are about to delete. Deleting a role or instance profile that is associated with a running instance will break any applications running on the instance.
iam-userdel -r
ROLENAME [
-c [-p] ]
| Name | Description | Required |
|---|---|---|
|
|
Name of the role to delete. Type: String Default: None |
Yes |
|
|
Deletes the role and deletes any associated instance profiles along with the role. Type: String Default: None |
Optional |
|
|
Returns what would be deleted, without actually recursively deleting the
role. Use this before using Type: String Constraints: You can apply Default: None |
Optional |
If the command is successful, the output is empty.
The following example deletes the role called myrole. This example assumes myrole has no associated instance profiles.
PROMPT> iam-roledel -r myroleThe following example shows what would be deleted if you were to recursively delete myrole.
PROMPT> iam-roledel -r myrole -c -p
instance profiles
arn:aws:iam::123456789012:instance-profile/myinstanceprofileThe following example recursively deletes the role myrole.
PROMPT> iam-roledel -r myrole -c