ImportSshPublicKey
Adds a Secure Shell (SSH) public key to a Transfer Family user identified by a
UserName
value assigned to the specific file transfer protocol-enabled server,
identified by ServerId
.
The response returns the UserName
value, the ServerId
value, and
the name of the SshPublicKeyId
.
Request Syntax
{
"ServerId": "string
",
"SshPublicKeyBody": "string
",
"UserName": "string
"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- ServerId
-
A system-assigned unique identifier for a server.
Type: String
Length Constraints: Fixed length of 19.
Pattern:
s-([0-9a-f]{17})
Required: Yes
- SshPublicKeyBody
-
The public key portion of an SSH key pair.
AWS Transfer Family accepts RSA, ECDSA, and ED25519 keys.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 2048.
Required: Yes
- UserName
-
The name of the Transfer Family user that is assigned to one or more servers.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 100.
Pattern:
[\w][\w@.-]{2,99}
Required: Yes
Response Syntax
{
"ServerId": "string",
"SshPublicKeyId": "string",
"UserName": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- ServerId
-
A system-assigned unique identifier for a server.
Type: String
Length Constraints: Fixed length of 19.
Pattern:
s-([0-9a-f]{17})
- SshPublicKeyId
-
The name given to a public key by the system that was imported.
Type: String
Length Constraints: Fixed length of 21.
Pattern:
key-[0-9a-f]{17}
- UserName
-
A user name assigned to the
ServerID
value that you specified.Type: String
Length Constraints: Minimum length of 3. Maximum length of 100.
Pattern:
[\w][\w@.-]{2,99}
Errors
For information about the errors that are common to all actions, see Common Errors.
- InternalServiceError
-
This exception is thrown when an error occurs in the AWS Transfer Family service.
HTTP Status Code: 500
- InvalidRequestException
-
This exception is thrown when the client submits a malformed request.
HTTP Status Code: 400
- ResourceExistsException
-
The requested resource does not exist, or exists in a region other than the one specified for the command.
HTTP Status Code: 400
- ResourceNotFoundException
-
This exception is thrown when a resource is not found by the AWSTransfer Family service.
HTTP Status Code: 400
- ServiceUnavailableException
-
The request has failed because the AWSTransfer Family service is not available.
HTTP Status Code: 500
- ThrottlingException
-
The request was denied due to request throttling.
HTTP Status Code: 400
Examples
Example
This command imports an ECDSA key stored in the id_ecdsa.pub
file.
aws transfer import-ssh-public-key --server-id s-021345abcdef6789 --ssh-public-key-body file://id_ecdsa.pub --user-name jane-doe
Example
If you run the previous command, the system returns the following information.
{ "ServerId": "s-021345abcdef6789", "SshPublicKeyId": "key-1234567890abcdef0", "UserName": "jane-doe" }
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: