Docs Home → MongoDB Cloud Manager
SSH Keys
On this page
Note
Groups and projects are synonymous terms. Your {PROJECT-ID}
is the
same as your project id. For existing groups, your group/project id
remains the same. This page uses the more familiar term group when
referring to descriptions. The endpoint remains as stated in the
document.
The sshKeys
resource displays the public keys available to choose from
when you provision servers through Cloud Manager's integration with a cloud service
provider. When you provision a new server, Cloud Manager adds the public key to the
server's authorized keys list. You must have the corresponding private key to
log into the provisioned server.
For more information on Cloud Manager integration with cloud service providers, see Provision Servers.
Base URL: https://cloud.mongodb.com/api/public/v1.0
Endpoints
Get All SSH Keys for the Project
GET /groups/{PROJECT-ID}/sshKeys
Get an SSH Key by ID
GET /groups/{PROJECT-ID}/sshKeys/KEY-ID
Get an SSH Key by Name
GET /groups/{PROJECT-ID}/sshKeys/byName/KEY-NAME
Add an SSH Key
POST /groups/{PROJECT-ID}/sshKeys
Delete an SSH Key
DELETE /groups/{PROJECT-ID}/sshKeys/KEY-ID
Sample Entity
{ "id" : "545e3e3ae4b08a04fbc21005", "name" : "myKey", "publicKey" : "<ssh-key>", "links" : [] }
Entity Fields
Name | Type | Description |
---|---|---|
id | string | Unique identifier. |
name | string | The name of the public key as it appears in Cloud Manager Provisioning Settings.
For more information on provisioning, see Provision Servers. |
publicKey | string | The contents of the public key. |
Links
Relation | Description |
---|---|
self | Me |
http://mms.mongodb.com/group | The project the SSH key belongs to |
Examples
Get All SSH Keys
Request
curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/sshKeys"
Response
Response Header
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
Response Body
{ "totalCount" : 1, "results" : [ { "id" : "545e3e3ae4b08a04fbc21005", "name" : "myKey", "publicKey" : "<ssh-key>", "links" : [] }, { ...} ], "links" : [] }
Get an SSH Key by ID
Request
curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/sshKeys/545e3e3ae4b08a04fbc21005"
Response
Response Header
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
Response Body
{ "id" : "545e3e3ae4b08a04fbc21005", "name" : "myKey", "publicKey" : "<ssh-key>", "links" : [] }
Add an SSH Key
Request
curl -u "username:apiKey" --digest -i -H "Content-Type: application/json" -X POST "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/sshKeys" --data ' { "name" : "myKey", "publicKey" : "<ssh-key>" }'
Response
HTTP/1.1 201 Created { "id" : "54c7a8bee4b0b5a9451be44e", "name" : "myKey", "publicKey" : "<ssh-key>", "links" : [] }
Delete an SSH Key
Request
curl -u "username:apiKey" --digest -i -X DELETE "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/sshKeys/545e3e3ae4b08a04fbc21005"
Response
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes} X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
This endpoint doesn't return a response body.