assumeRoot
Returns a set of short term credentials you can use to perform privileged tasks on a member account in your organization. You must use credentials from an Organizations management account or a delegated administrator account for IAM to call AssumeRoot. You cannot use root user credentials to make this call.
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.
When granting access to privileged tasks you should only grant the necessary permissions required to perform that task. For more information, see Security best practices in IAM. In addition, you can use service control policies (SCPs) to manage and limit permissions in your organization. See General examples in the Organizations User Guide for more information on SCPs.
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
}