STS AssumeRole(角色扮演)常見錯誤及原因如下:
序號 | 錯誤 | 原因 |
1 | ErrorCode: NoPermission ErrorMessage: Roles may not be assumed by root accounts. | 使用主使用者的密鑰調用AssumeRole,請使用子使用者的密鑰。 |
2 | ErrorCode: MissingSecurityToken ErrorMessage: SecurityToken is mandatory for this action. | 使用臨時使用者的密鑰調用AssumeRole,請使用子使用者的密鑰。 |
3 | Error code: InvalidAccessKeyId.NotFound Error message: Specified access key is not found | AccessKeyId無效,請檢查是否寫錯,特別是前後不能有空格。 |
4 | Error code: InvalidAccessKeyId.Inactive Error message: Specified access key is disabled. | 使用的子使用者的密鑰,已經被禁止,請啟用密鑰或更換密鑰。 密鑰是否被禁止,請通過控制台的 | 確認,並開啟。
5 | ErrorCode: InvalidParameter.PolicyGrammar ErrorMessage: The parameter Policy has not passed grammar check. | 角色扮演時指定的授權策略無效。角色扮演時可以指定授權(Policy),也可以不指定。如果指定授權策略,則臨時使用者的許可權是指定的授權策略和角色許可權的交集;如果不指定授權策略,臨時使用者的許可權是角色的許可權。報該錯誤時,請檢查指定的授權策略Policy。不推薦臨時使用者扮演角色時指定授權策略。如果的確需要使用授權策略,強烈建議使用RAM Policy Editor產生授權策略。 |
6 | ErrorCode: InvalidParameter.RoleSessionNameErrorMessage: The parameter RoleSessionName is wrongly formed. | 角色扮演時指定RoleSessionName無效。此參數用來區分不同的Token,以標明誰在使用此Token,便於審計。格式:^[a-zA-Z0-9.@-_]+$,2-32個字元。
瞭解更多請參看扮演角色操作介面。如命名 瞭解更多請參看扮演角色操作介面。如命名 |
7 | ErrorCode: InvalidParameter.DurationSeconds Error message: The Min/Max value of DurationSeconds is 15min/1hr. | 角色扮演時指定的到期時間無效,即AssumeRoleRequest.setDurationSeconds參數無效。角色扮演時可以指定到期時間,單位為秒,有效時間是900 ~ 3600,如assumeRoleRequest.setDurationSeconds(60L * 20) ,20分鐘內有效。 |
8 | ErrorCode: NoPermissionErrorMessage: No permission perform sts:AssumeRole on this Role. Maybe you are not authorized to perform sts:AssumeRole or the specified role does not trust you |
|
說明
- Java角色扮演的樣本,請參看GitHub。
- 其它的原因的角色扮示範例,請參考STS SDK使用手冊。
- 其它的原因的角色扮示範例,請參考STS SDK使用手冊。
- 您想更多瞭解阿里雲存取控制(RAM),請參看阿里雲存取控制初探 。