Use RemoveRoleFromInstanceProfile with a CLI
The following code examples show how to use RemoveRoleFromInstanceProfile.
- CLI
-
- AWS CLI
-
To remove a role from an instance profile
The following
remove-role-from-instance-profilecommand removes the role namedTest-Rolefrom the instance profile namedExampleInstanceProfile.aws iam remove-role-from-instance-profile \ --instance-profile-nameExampleInstanceProfile\ --role-nameTest-RoleFor more information, see Using instance profiles in the AWS IAM User Guide.
-
For API details, see RemoveRoleFromInstanceProfile
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example deletes the role named
MyNewRolefrom the EC2 instance profile namedMyNewRole. An instance profile that is created in the IAM console always has the same name as the role, as in this example. If you create them in the API or CLI, then they can have different names.Remove-IAMRoleFromInstanceProfile -InstanceProfileName MyNewRole -RoleName MyNewRole -Force-
For API details, see RemoveRoleFromInstanceProfile in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example deletes the role named
MyNewRolefrom the EC2 instance profile namedMyNewRole. An instance profile that is created in the IAM console always has the same name as the role, as in this example. If you create them in the API or CLI, then they can have different names.Remove-IAMRoleFromInstanceProfile -InstanceProfileName MyNewRole -RoleName MyNewRole -Force-
For API details, see RemoveRoleFromInstanceProfile in AWS Tools for PowerShell Cmdlet Reference (V5).
-
For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.