Submits a service-linked role deletion request and returns a DeletionTaskId
, which you can use to check the status of the deletion. Before you call this operation, confirm that the role has no active sessions and that any resources used by the role in the linked service are deleted. If you call this operation more than once for the same service-linked role and an earlier deletion task is not complete, then the DeletionTaskId
of the earlier request is returned.
If you submit a deletion request for a service-linked role whose linked service is still accessing a resource, then the deletion task fails. If it fails, the GetServiceLinkedRoleDeletionStatus API operation returns the reason for the failure, usually including the resources that must be deleted. To delete the service-linked role, you must first remove those resources from the linked service and then submit the deletion request again. Resources are specific to the service that is linked to the role. For more information about removing resources from a service, see the AWS documentation for your service.
For more information about service-linked roles, see Roles Terms and Concepts: AWS Service-Linked Role in the IAM User Guide .
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
delete-service-linked-role
--role-name <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--role-name
(string)
The name of the service-linked role to be deleted.
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
To delete a service-linked role
The following delete-service-linked-role
example deletes the specified service-linked role that you no longer need. The deletion happens asynchronously. You can check the status of the deletion and confirm when it is done by using the get-service-linked-role-deletion-status
command.
aws iam delete-service-linked-role --role-name AWSServiceRoleForLexBots
Output:
{
"DeletionTaskId": "task/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots/1a2b3c4d-1234-abcd-7890-abcdeEXAMPLE"
}
For more information, see Using Service-Linked Roles in the IAM User Guide.
DeletionTaskId -> (string)
The deletion task identifier that you can use to check the status of the deletion. This identifier is returned in the format
task/aws-service-role/<service-principal-name>/<role-name>/<task-uuid>
.