createRole

abstract suspend fun createRole(input: CreateRoleRequest): CreateRoleResponse

Creates a new role for your Amazon Web Services account.

For more information about roles, see IAM roles in the IAM User Guide. For information about quotas for role names and the number of roles you can create, see IAM and STS quotas in the IAM User Guide.

Samples


fun main() { 
   //sampleStart 
   // The following command creates a role named Test Role and attaches a trust policy that you must
// convert from JSON to a string. Upon success, the response includes the same policy as a URL encoded JSON
// string.
val resp = iamClient.createRole {
    assumeRolePolicyDocument = "<Stringified-JSON>"
    path = "/"
    roleName = "Test-Role"
} 
   //sampleEnd
}