User guide
Console.WriteLine(" Policies:");
foreach (var policy in role.GetPolicies())
{
Console.WriteLine(" {0}", policy.Name);
}
Console.WriteLine(" InstanceProfiles:");
foreach (var instanceProfile in role.GetInstanceProfiles())
{
Console.WriteLine(" {0}", instanceProfile.Name);
}
}
Create a User Account
The following example creates a new user account and then displays some information about it:
// using Amazon.IdentityManagement.Resources;
// using Amazon.IdentityManagement.Model;
var iam = new IdentityManagementService();
try
{
var user = iam.CreateUser("DemoUser");
Console.WriteLine("User Name = '{0}', ARN = '{1}'",
user.Name, user.Arn);
}
catch (EntityAlreadyExistsException)
{
Console.WriteLine("User 'DemoUser' already exists.");
}
Create a Group
The following example creates a new group and then confirms whether the group was successfully
created:
// using Amazon.IdentityManagement.Resources;
// using Amazon.IdentityManagement.Model;
var iam = new IdentityManagementService();
try
{
var group = iam.CreateGroup("DemoGroup");
Console.WriteLine(group.Name + " was created.");
}
catch (EntityAlreadyExistsException)
{
Version v2.0.0
98
AWS SDK for .NET Developer Guide
IAM Resource API Examples