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-instanceprofiledel

Description

Deletes an instance profile.

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.

For more information about instance profiles, go to About Instance Profiles in Using AWS Identity and Access Management.

Syntax

iam-instanceprofiledel -s INSTANCEPROFILENAME [ -r [-p] ]

Options

Name Description Required

-s INSTANCEPROFILENAME

The name of the instance profile to delete.

Type: String

Yes

-r

Deletes the associated roles along with the instance profile.

Type: String

Default: None

Optional

-r -p

Returns the roles that would be deleted, without actually recursively deleting the instance profile or the roles. Use this option before using -r to ensure you are not deleting any roles you don't want to. 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 successful, the output is empty.

Example

The following example deletes the instance profile named myinstanceprofile. This example assumes the instance profile doesn't have roles attached.

PROMPT> iam-instanceprofiledel -s myinstanceprofile

The following example shows the roles associated with the instance profile that would be deleted if you were to recursively delete myinstanceprofile.

PROMPT> iam-instanceprofiledel -s myinstanceprofile -r -p
roles
    arn:aws:iam::123456789012:role/myrole

The following example recursively deletes myinstanceprofile.

PROMPT> iam-instanceprofiledel -s myinstanceprofile -r