update_role
async
¶
update_role(
role_name: roleNameType,
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
description: Optional[roleDescriptionType] = None,
max_session_duration: Optional[roleMaxSessionDurationType] = None,
max_signin_session_duration: Optional[maxSigninSessionDurationType] = None,
reset_max_signin_session_duration: Optional[booleanObjectType] = None,
) -> UpdateRoleResponse
Updates the description, maximum session duration, or maximum sign-in session duration of a role. You cannot change the maximum sign-in session duration of a service-linked role.
Parameters:
-
role_name(roleNameType) –The name of the role that you want to modify.
-
description(Optional[roleDescriptionType], default:None) –The new description that you want to apply to the specified role.
-
max_session_duration(Optional[roleMaxSessionDurationType], default:None) –The maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default value of one hour is applied. This setting can have a value from 1 hour to 12 hours.
Anyone who assumes the role from the CLI or API can use the
DurationSecondsAPI parameter or theduration-secondsCLI parameter to request a longer session. TheMaxSessionDurationsetting determines the maximum duration that can be requested using theDurationSecondsparameter. If users don't specify a value for theDurationSecondsparameter, their security credentials are valid for one hour by default. This applies when you use theAssumeRole*API operations or theassume-role*CLI operations but does not apply when you use those operations to create a console URL. For more information, see Using IAM roles in the IAM User Guide.IAM role credentials provided by Amazon EC2 instances assigned to the role are not subject to the specified maximum session duration.
-
max_signin_session_duration(Optional[maxSigninSessionDurationType], default:None) –The maximum Amazon Web Services Sign-In duration (in seconds) for users who authenticate with the specified role through OAuth-based flows (
signin:CreateOAuth2Token), such as the AWS CLI (aws login), Amazon Web Services SDKs, and MCP clients. This setting does not affect Amazon Web Services Management Console browser sessions or traditional STS sessions. This setting can have a value from 1 hour (3600 seconds) to 90 days (7776000 seconds), inclusive, and overrides any value currently configured for the role. This setting is independent ofMaxSessionDuration. If this parameter is not set, the default session duration equals the role'sMaxSessionDuration.If you omit both this parameter and
ResetMaxSigninSessionDuration, the current setting is unchanged. You cannot specify this parameter and setResetMaxSigninSessionDurationtotruein the same request.Changes to this setting apply to new sign-in sessions. Sessions that are already established are not affected.
You cannot set this value on a service-linked role.
-
reset_max_signin_session_duration(Optional[booleanObjectType], default:None) –Specifies whether to clear the role's maximum sign-in session duration. Set this value to
trueto return the setting to its unset state, so that the existing sign-in session behavior applies.If you set this value to
falseor omit it, the current setting is not cleared. You cannot set this value totrueand specifyMaxSigninSessionDurationin the same request. Clearing a setting that is already unset has no effect.You cannot reset this value on a service-linked role.
Raises:
-
InvalidInputException–The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
NoSuchEntityException–The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
-
ServiceFailureException–The request processing has failed because of an unknown error, exception or failure.
-
UnmodifiableEntityException–The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_iam/_services/async_iam.py
12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 | |