Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use RemoveRoleFromInstanceProfile
with an Amazon SDK or command line tool
The following code examples show how to use RemoveRoleFromInstanceProfile
.
- CLI
-
- Amazon CLI
-
To remove a role from an instance profile
The following remove-role-from-instance-profile
command removes the role named Test-Role
from the instance
profile named ExampleInstanceProfile
.
aws iam remove-role-from-instance-profile \
--instance-profile-name ExampleInstanceProfile \
--role-name Test-Role
For more information, see Using instance profiles in the Amazon IAM User Guide.
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example deletes the role named MyNewRole
from the EC2 instance profile named MyNewRole
. 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 a complete list of Amazon SDK developer guides and code examples, see
Using IAM with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.