update_access_key
¶
update_access_key(
access_key_id: accessKeyIdType,
status: statusType,
*,
config_overrides: Optional[IAMClientConfig] = None,
user_name: Optional[existingUserNameType] = None,
) -> None
Changes the status of the specified access key from Active to Inactive, or vice versa. This operation can be used to disable a user's key as part of a key rotation workflow.
If the UserName is not specified, the user name is determined implicitly based on the Amazon Web Services access key ID used to sign the request. If a temporary access key is used, then UserName is required. If a long-term key is assigned to the user, then UserName is not required. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials even if the Amazon Web Services account has no associated users.
For information about rotating keys, see Managing keys and certificates in the IAM User Guide.
Parameters:
-
user_name(Optional[existingUserNameType], default:None) –The name of the user whose key you want to update.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
-
access_key_id(accessKeyIdType) –The access key ID of the secret access key you want to update.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
-
status(statusType) –The status you want to assign to the secret access key.
Activemeans that the key can be used for programmatic calls to Amazon Web Services, whileInactivemeans that the key cannot be used.
Raises:
-
InvalidInputException–The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
LimitExceededException–The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
-
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.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To activate or deactivate an access key for an IAM user The following command deactivates the specified access key (access key ID and secret access key) for the IAM user named Bob.
>>> client.update_access_key(user_name='Bob', status='Inactive', access_key_id='AKIAIOSFODNN7EXAMPLE')
Source code in docs_src/capo_iam/_services/iam.py
10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 | |