update_role
¶
update_role(
role_name: roleNameType,
*,
config_overrides: Optional[IAMClientConfig] = 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/iam.py
12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 | |