ec2.key-pairs.importRegister an existing SSH public key
One store with `kms ssh-key-pairs` (list, generate, sync from a password manager): the pair is the same object there, under the same id.
Request syntax
POST /ec2/api/key-pairs
{
"name": "string",
"regionId": "string",
"publicKey": "string",
"tags": "map of string"
}Request body
nameRequiredstring
A display name
Constraints: 1-64 chars
regionIdOptionalstring
Ignored: an SSH key is not regional. Kept for old clients
Constraints: min 1 chars
publicKeyRequiredstring
The public key in OpenSSH format, e.g. "ssh-ed25519 AAAA… comment"
Constraints: min 1 chars
tagsOptionalmap of string
Tags for the new resource, e.g. {"env": "prod", "project": "shop"}. Keys your organization marks required must be present, or the create is refused with the missing keys (GET /tags/api/keys lists them).
Constraints: key=value
Response
201: `data` is the key pair: id, name, publicKey, fingerprint (SHA256:…), keyType (ed25519 or rsa).
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow ec2:ImportKeyPair on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud ec2 key-pairs import --name example --public-key examplecurl -X POST "https://console.platform-development.deutschecloud.app/ec2/api/key-pairs" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"example","publicKey":"example"}'Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_ec2_key-pairs_import.