ALIYUN::ECS::SSHKeyPair類型用於建立SSH金鑰組或匯入已有的SSH金鑰組。
文法
{
"Type": "ALIYUN::ECS::SSHKeyPair",
"Properties": {
"ResourceGroupId": String,
"KeyPairName": String,
"PublicKeyBody": String,
"Tags": List
}
}屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
ResourceGroupId | String | 否 | 是 | 執行個體所在的資源群組ID。 | 無 |
KeyPairName | String | 是 | 否 | 金鑰組的名稱。 | 長度為2~128個字元。必須以英文字母或漢字開頭,不能以 |
PublicKeyBody | String | 否 | 否 | 金鑰組的公開金鑰內容。 | 僅在匯入金鑰組時需要指定該參數。 |
Tags | List | 否 | 是 | 標籤。 | 最多支援添加20個標籤。 更多資訊,請參見Tags屬性。 |
Tags文法
"Tags": [
{
"Key": String,
"Value": String
}
] Tags屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Key | String | 是 | 否 | 標籤鍵。 | 長度為1~128個字元,不能以 |
Value | String | 否 | 否 | 標籤值。 | 長度為0~128個字元,不能以 |
傳回值
Fn::GetAtt
KeyPairFingerPrint:金鑰組的指紋。根據RFC4716定義的公開金鑰指紋格式,採用MD5資訊摘要演算法。
PrivateKeyBody:金鑰組的私密金鑰。未加密的PEM編碼PKCS#8格式的RSA私密金鑰內容。只有在第一次建立完成後有唯一的機會擷取金鑰組的私密金鑰。如果是匯入已有公開金鑰,則不會有私密金鑰資訊。
KeyPairName:金鑰組名稱。
Arn:阿里雲資源名稱。
樣本
ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
SSHKeyPair:
Type: ALIYUN::ECS::SSHKeyPair
Properties:
KeyPairName:
Fn::Sub: ess-${ALIYUN::StackId}
Outputs:
KeyPairFingerPrint:
Description: 'The fingerprint of the key pair. The public key fingerprint format defined in RFC4716: MD5 message digest algorithm. '
Value:
Fn::GetAtt:
- SSHKeyPair
- KeyPairFingerPrint
KeyPairName:
Description: SSH Key pair name.
Value:
Fn::GetAtt:
- SSHKeyPair
- KeyPairName
PrivateKeyBody:
Description: 'The private key of the key pair. Content of the RSA private key in the PKCS#8 format of the unencrypted PEM encoding. Refer to: https://www.openssl.org/docs/apps/pkcs8.html.User only can get the private key one time when and only when SSH key pair is created.'
Value:
Fn::GetAtt:
- SSHKeyPair
- PrivateKeyBody{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
},
"Resources": {
"SSHKeyPair": {
"Type": "ALIYUN::ECS::SSHKeyPair",
"Properties": {
"KeyPairName": {
"Fn::Sub": "ess-${ALIYUN::StackId}"
}
}
}
},
"Outputs": {
"KeyPairFingerPrint": {
"Description": "The fingerprint of the key pair. The public key fingerprint format defined in RFC4716: MD5 message digest algorithm. ",
"Value": {
"Fn::GetAtt": [
"SSHKeyPair",
"KeyPairFingerPrint"
]
}
},
"KeyPairName": {
"Description": "SSH Key pair name.",
"Value": {
"Fn::GetAtt": [
"SSHKeyPair",
"KeyPairName"
]
}
},
"PrivateKeyBody": {
"Description": "The private key of the key pair. Content of the RSA private key in the PKCS#8 format of the unencrypted PEM encoding. Refer to: https://www.openssl.org/docs/apps/pkcs8.html.User only can get the private key one time when and only when SSH key pair is created.",
"Value": {
"Fn::GetAtt": [
"SSHKeyPair",
"PrivateKeyBody"
]
}
}
}
}更多樣本,請參見YAML樣本。