There are more AWS SDK examples available in the AWS Doc SDK Examples
Delete an IAM role policy using an AWS SDK
The following code example shows how to delete an IAM role policy.
- .NET
-
- AWS SDK for .NET
-
Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. using System; using System.Threading.Tasks; using Amazon.IdentityManagement; using Amazon.IdentityManagement.Model; public class DeleteRolePolicy { /// <summary> /// Initializes the IAM client object and then calls DeleteRolePolicyAsync /// to delete the Policy attached to the Role. /// </summary> public static async Task Main() { var client = new AmazonIdentityManagementServiceClient(); var response = await client.DeleteRolePolicyAsync(new DeleteRolePolicyRequest { PolicyName = "ExamplePolicy", RoleName = "Test-Role", }); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine("Policy successfully deleted."); } else { Console.WriteLine("Could not delete pollicy."); } } }
-
For API details, see DeleteRolePolicy in AWS SDK for .NET API Reference.
-
Delete a role
Delete a server certificate