最近更新时间:2023.09.06 07:43:38
首次发布时间:2022.07.01 09:25:16
调用 CreateKeyPair 接口创建一个密钥对。
说明
您在同一地域内最多可创建500个密钥对。
密钥对创建成功后,系统会为您保管密钥对的公钥部分,私钥文件将自动下载到您的本地,默认文件名为:密钥名称.pem。您只有一次下载私钥的机会,火山引擎不会保存您的私钥,请务必保管好该私钥。
名称 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateKeyPair | 要执行的操作,取值:CreateKeyPair。 |
Version | String | 是 | 2020-04-01 | API的版本,取值:2020-04-01。 |
KeyPairName | String | 是 | ssh_key_pair | 密钥对名称。
|
Description | String | 否 | ssh_key_pair description | 密钥对的描述,默认值为空字符串。
|
ProjectName | String | 否 | project_a | 资源所属项目,一个资源只能归属于一个项目。
|
ClientToken | String | 否 | 333456899ff**** | 保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。 |
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
KeyPairName | String | ssh_key_pair | 密钥对名称。 |
PrivateKey | String | -----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAw7ked3y+qiEoWcGqJB8eK5U+NEzopTrx5zyC4l2QbVc9NFh1\\nx5DQGs5YFvum3EOExdv1RZP1b/+vT4CWaHE7yw8dfYU6WZK/CFFVAsn1855RhPgT****** | 密钥对私钥信息。 |
KeyPairId | String | kp-ybqcopwrdwl8j1****** | 密钥对唯一ID。 |
FingerPrint | String | 4158f40dbc0814eb04f0dcac4e****** | 密钥对的指纹。根据RFC4716定义的公钥指纹格式,采用MD5信息摘要算法。 |
GET /?Action=CreateKeyPair&Version=2020-04-01&KeyPairName=ssh_key_pair HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing Service: ecs
{ "ResponseMetadata": { "RequestId": "202106111445100102252431000052****", "Action": "CreateKeyPair", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": { "KeyPairName": "ssh_key_pair", "PrivateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAw7ked3y+qiEoWcGqJB8eK5U+NEzopTrx5zyC4l2QbVc9NFh1\nx5DQGs5YFvum3EOExdv1RZP1b/+vT4CWaHE7yw8dfYU6WZK/CFFVAsn1855RhPgT******", "KeyPairId": "kp-ybqcopwrdwl8j1******", "FingerPrint": "4158f40dbc0814eb04f0dcac4e******" } }
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | MissingParameter.KeyPairName | The required parameter KeyPairName is not supplied. | 密钥对名称不能为空。 |
400 | InvalidKeyPairName.Malformed | The specified KeyPairName is malformed. | 指定的密钥对名称不合法。 |
400 | InvalidKeyPairDescription.Malformed | The specified KeyPairDescription is malformed. | 指定的密钥对描述不合法。 |
400 | LimitExceeded.MaximumKeyPairs | You've reached the limit on the number of KeyPairs that you can create. | 创建的密钥对数量超过了最大限制。 |
400 | InvalidClientToken.Malformed | The specified ClientToken is malformed. | 指定的ClientToken不合法。 |
400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. | 幂等参数不一致。 |
404 | InvalidProject.NotFound | The specified Project does not exist. | 指定的项目不存在。 |
409 | InvalidKeyPairName.Conflict | The specified KeyPairName already exists. | 指定的密钥对名称重复。 |
412 | IdempotentProcessing | The request uses the same client token as a previous one that is still in process. | 先前的幂等请求仍在处理中,请稍后重试。 |
500 | InternalError | An internal error has occurred. | 内部错误,请重试。如果多次尝试失败,请提交工单。 |