Memanggil CreateKeyPair untuk membuat key pair SSH. Sistem pasangan kunci publik dan mengembalikan kunci privat berformat PKCS#8 yang dienkode PEM tanpa enkripsi. Anda harus pasangan kunci privat secara aman di tempat Anda sendiri.
Deskripsi operasi
Selain memanggil CreateKeyPair untuk membuat key pair, Anda dapat menggunakan alat pihak ketiga untuk membuat key pair lalu mengunggahnya (ImportKeyPair) ke suatu wilayah. Penggunaan key pair yang dibuat oleh alat pihak ketiga sama dengan key pair yang dibuat oleh sistem.
Anda dapat memiliki hingga 500 key pair di setiap wilayah. Untuk informasi selengkapnya, lihat Limits.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:CreateKeyPair |
create |
*KeyPair
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID wilayah key pair. Anda dapat memanggil DescribeRegions untuk mengkueri daftar wilayah terbaru. |
cn-hangzhou |
| KeyPairName |
string |
Yes |
Nama key pair. Panjang nama harus 2 hingga 128 karakter dan dapat berisi huruf, angka, titik dua (:), garis bawah (_), dan tanda hubung (-). Nama harus diawali dengan huruf dan tidak dapat diawali dengan |
testKeyPairName |
| ResourceGroupId |
string |
No |
ID kelompok sumber daya tempat key pair SSH berada. |
rg-bp67acfmxazb4p**** |
| Tag |
array<object> |
No |
Tag. |
|
|
object |
No |
Tag. |
||
| Key |
string |
No |
Kunci tag N key pair. Nilai valid N: 1 hingga 20. Kunci tag tidak boleh berupa string kosong. Panjang kunci tag dapat mencapai 128 karakter dan tidak dapat diawali dengan |
TestKey |
| Value |
string |
No |
Nilai tag N key pair. Nilai valid N: 1 hingga 20. Nilai tag dapat berupa string kosong. Panjang nilai tag dapat mencapai 128 karakter dan tidak dapat diawali dengan acs:. Nilai tag tidak dapat berisi http:// atau https://. |
TestValue |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| PrivateKeyBody |
string |
Kunci privat key pair. Kunci privat dienkode PEM dalam format PKCS#8. |
MIIEpAIBAAKCAQEAtReyMzLIcBH78EV2zj**** |
| KeyPairName |
string |
Nama key pair. |
testKeyPairName |
| KeyPairId |
string |
ID key pair SSH. |
ssh-bp67acfmxazb4p**** |
| RequestId |
string |
ID permintaan. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| KeyPairFingerPrint |
string |
Sidik jari key pair. Format sidik jari kunci publik didefinisikan oleh RFC 4716 dan menggunakan algoritma message digest MD5. Untuk informasi selengkapnya, lihat RFC 4716. |
89:f0:ba:62:ac:b8:aa:e1:61:5e:fd:81:69:86:6d:6b:f0:c0:5a:** |
Contoh
Respons sukses
JSONformat
{
"PrivateKeyBody": "MIIEpAIBAAKCAQEAtReyMzLIcBH78EV2zj****",
"KeyPairName": "testKeyPairName",
"KeyPairId": "ssh-bp67acfmxazb4p****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"KeyPairFingerPrint": "89:f0:ba:62:ac:b8:aa:e1:61:5e:fd:81:69:86:6d:6b:f0:c0:5a:**"
}
Respons error
JSONformat
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
"KeyPairName": "test"
"KeyPairFingerPrint": "89:f0:ba:62:ac:b8:aa:e1:61:5e:fd:81:69:86:6d:6b:f0:c0:5a:d7"
"PrivateKeyBody": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidKeyPairName.Malformed | Specified Key Pair name is not valid. | The specified key pair name is invalid. |
| 400 | KeyPair.AlreadyExist | The key pair already exist. | The key pair already exists. Do not add it again. |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | Duplicate tag keys exist. Make sure that each tag key is unique. |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | The specified tag key parameter is invalid. |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | The specified tag value parameter is invalid. |
| 403 | QuotaExceed.KeyPair | The key pair quota exceeds. | |
| 403 | QuotaExceed.Tags | %s | The number of tags exceeds the maximum number that can be configured. %s is a variable. The error message is dynamically returned based on the actual API call. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | The region information is invalid. |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The resource group does not exist in the records. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.