Skip to main content

ssh_public_keys

Creates, updates, deletes, gets or lists a ssh_public_keys resource.

Overview

Namessh_public_keys
TypeResource
Idaws.iam.ssh_public_keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
fingerprintstringThe MD5 message digest of the SSH public key.
ssh_public_key_bodystringThe SSH public key.
ssh_public_key_idstringThe unique identifier for the SSH public key.
statusstringThe status of the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
upload_datestringThe date and time, in ISO 8601 date-time format, when the SSH public key was uploaded.
user_namestringThe name of the IAM user associated with the SSH public key.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_ssh_public_keyselectUserName, SSHPublicKeyId, Encoding, regionRetrieves the specified SSH public key, including metadata about the key. The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.
list_ssh_public_keysselectregionUserName, Marker, MaxItemsReturns information about the SSH public keys associated with the specified IAM user. If none exists, the operation returns an empty list. The SSH public keys returned by this operation are used only for authenticating the IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide. Although each user is limited to a small number of keys, you can still paginate the results using the MaxItems and Marker parameters.
update_ssh_public_keyupdateUserName, SSHPublicKeyId, regionStatusSets the status of an IAM user's SSH public key to active or inactive. SSH public keys that are inactive cannot be used for authentication. This operation can be used to disable a user's SSH public key as part of a key rotation work flow. The SSH public key affected by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.
delete_ssh_public_keydeleteUserName, SSHPublicKeyId, regionDeletes the specified SSH public key. The SSH public key deleted by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
EncodingstringSpecifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
SSHPublicKeyIdstringThe unique identifier for the SSH public key. This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
UserNamestringThe name of the IAM user associated with the SSH public key. 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: _+=,.@-
regionstringAWS region (default: us-east-1)
MarkerstringUse this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
MaxItemsintegerUse this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true. If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true, and Marker contains a value to include in the subsequent call that tells the service where to continue from.
StatusstringThe status to assign to the SSH public key. Active means that the key can be used for authentication with an CodeCommit repository. Inactive means that the key cannot be used.
UserNamestringThe name of the IAM user to list SSH public keys for. If none is specified, the UserName field is determined implicitly based on the Amazon Web Services access key used to sign the request. 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: _+=,.@-

SELECT examples

Retrieves the specified SSH public key, including metadata about the key. The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.

SELECT
fingerprint,
ssh_public_key_body,
ssh_public_key_id,
status,
upload_date,
user_name
FROM aws.iam.ssh_public_keys
WHERE UserName = '{{ UserName }}' -- required
AND SSHPublicKeyId = '{{ SSHPublicKeyId }}' -- required
AND Encoding = '{{ Encoding }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Sets the status of an IAM user's SSH public key to active or inactive. SSH public keys that are inactive cannot be used for authentication. This operation can be used to disable a user's SSH public key as part of a key rotation work flow. The SSH public key affected by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.

UPDATE aws.iam.ssh_public_keys
SET
-- No updatable properties
WHERE
UserName = '{{ UserName }}' --required
AND SSHPublicKeyId = '{{ SSHPublicKeyId }}' --required
AND region = '{{ region }}' --required
AND Status = '{{ Status}}';

DELETE examples

Deletes the specified SSH public key. The SSH public key deleted by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.

DELETE FROM aws.iam.ssh_public_keys
WHERE UserName = '{{ UserName }}' --required
AND SSHPublicKeyId = '{{ SSHPublicKeyId }}' --required
AND region = '{{ region }}' --required
;