assumeRoot

abstract suspend fun assumeRoot(input: AssumeRootRequest): AssumeRootResponse

Returns a set of short term credentials you can use to perform privileged tasks on a member account in your organization.

Before you can launch a privileged session, you must have centralized root access in your organization. For steps to enable this feature, see Centralize root access for member accounts in the IAM User Guide.

The STS global endpoint is not supported for AssumeRoot. You must send this request to a Regional STS endpoint. For more information, see Endpoints.

You can track AssumeRoot in CloudTrail logs to determine what actions were performed in a session. For more information, see Track privileged tasks in CloudTrail in the IAM User Guide.

Samples

import aws.sdk.kotlin.services.sts.model.PolicyDescriptorType
fun main() { 
   //sampleStart 
   // The following command retrieves a set of short term credentials you can use to unlock an S3 bucket
// for a member account by removing the bucket policy.
val resp = stsClient.assumeRoot {
    targetPrincipal = "111122223333"
    taskPolicyArn = PolicyDescriptorType {
        arn = "arn:aws:iam::aws:policy/root-task/S3UnlockBucketPolicy"
    }
    durationSeconds = 900
} 
   //sampleEnd
}