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:阿里云资源名称。
示例
YAML
JSON
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示例。
该文章对您有帮助吗?
- 本页导读 (1)
- 语法
- 属性
- Tags语法
- Tags属性
- 返回值
- 示例