Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class UploadSSHPublicKeyCommandProtected

Uploads an SSH public key and associates it with the specified IAM user.

The SSH public key uploaded by this operation can be 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.

Example

Use a bare-bones client and the command you need to make an API call.

import { IAMClient, UploadSSHPublicKeyCommand } from "@aws-sdk/client-iam"; // ES Modules import
// const { IAMClient, UploadSSHPublicKeyCommand } = require("@aws-sdk/client-iam"); // CommonJS import
const client = new IAMClient(config);
const input = { // UploadSSHPublicKeyRequest
UserName: "STRING_VALUE", // required
SSHPublicKeyBody: "STRING_VALUE", // required
};
const command = new UploadSSHPublicKeyCommand(input);
const response = await client.send(command);
// { // UploadSSHPublicKeyResponse
// SSHPublicKey: { // SSHPublicKey
// UserName: "STRING_VALUE", // required
// SSHPublicKeyId: "STRING_VALUE", // required
// Fingerprint: "STRING_VALUE", // required
// SSHPublicKeyBody: "STRING_VALUE", // required
// Status: "Active" || "Inactive", // required
// UploadDate: new Date("TIMESTAMP"),
// },
// };

Param

UploadSSHPublicKeyCommandInput

Returns

UploadSSHPublicKeyCommandOutput

See

Throws

DuplicateSSHPublicKeyException (client fault)

The request was rejected because the SSH public key is already associated with the specified IAM user.

Throws

InvalidPublicKeyException (client fault)

The request was rejected because the public key is malformed or otherwise invalid.

Throws

LimitExceededException (client fault)

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.

Throws

NoSuchEntityException (client fault)

The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.

Throws

UnrecognizedPublicKeyEncodingException (client fault)

The request was rejected because the public key encoding format is unsupported or unrecognized.

Throws

IAMServiceException

Base exception class for all service exceptions from IAM service.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods