Skip to content

IAM  >  Operations  >  delete_role

delete_role

Operation

delete_role async

delete_role(input: DeleteRoleInput, plugins: list[Plugin] | None = None) -> DeleteRoleOutput

Deletes the specified role. Unlike the Amazon Web Services Management Console, when you delete a role programmatically, you must delete the items attached to the role manually, or the deletion fails. For more information, see Deleting an IAM role. Before attempting to delete a role, remove the following attached items:

Warning

Make sure that you do not have any Amazon EC2 instances running with the role 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.

Parameters:

Name Type Description Default
input DeleteRoleInput

An instance of DeleteRoleInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DeleteRoleOutput

An instance of DeleteRoleOutput.

Input

DeleteRoleInput dataclass

Bases: _SerdeShape

Dataclass for DeleteRoleInput structure.

Attributes

role_name class-attribute instance-attribute
role_name: str | None = ...

The name of the role to delete.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Output

DeleteRoleOutput dataclass

Bases: _SerdeShape

Dataclass for DeleteRoleOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.