La ressource ALIYUN::KMS::Key crée une clé maître.
Syntaxe
{
"Type": "ALIYUN::KMS::Key",
"Properties": {
"KeyUsage": String,
"Enable": Boolean,
"PendingWindowInDays": Integer,
"Description": String,
"KeySpec": String,
"EnableAutomaticRotation": Boolean,
"RotationInterval": String,
"ProtectionLevel": String,
"DKMSInstanceId": String,
"KeyUsage": String,
"Policy": Map,
"DeletionProtection": Boolean,
"Tags": List
}
}
Propriétés
Nom de la propriété | Type | Obligatoire | Mise à jour possible | Description | Contrainte |
DKMSInstanceId | String | Non | Non | ID de l'instance KMS dédié. | Votre instance KMS existante est mise à niveau vers un KMS dédié. Pour plus d'informations sur cette mise à niveau, consultez [Avis de mise à niveau] Le KMS est mis à niveau vers un KMS dédié. |
DeletionProtection | Boolean | Non | Oui | Indique si la protection contre la suppression est activée. | Valeurs valides :
|
Description | String | Non | Oui | Description de la clé. | La description doit comporter entre 0 et 8 192 caractères. |
Enable | Boolean | Non | Oui | Active ou désactive la clé. | Valeurs valides :
|
KeyUsage | String | Non | Non | Utilisation prévue de la clé. | Valeurs valides :
Valeur par défaut : SIGN/VERIFY si la clé prend en charge la vérification des signatures. Sinon, la valeur par défaut est ENCRYPT/DECRYPT. |
EnableAutomaticRotation | Boolean | Non | Oui | Active ou désactive la rotation automatique des clés. | Valeurs valides :
|
KeySpec | String | Non | Non | Type de la clé. | Valeurs valides :
Remarque En Chine continentale, les clés créées à l'aide de HSM gérés utilisent Aliyun_SM4 par défaut. Dans tous les autres cas, les clés utilisent Aliyun_AES_256 par défaut. |
PendingWindowInDays | Integer | Non | Non | Délai d'attente avant suppression. Pendant cette période, vous pouvez annuler la suppression d'une clé dont l'état est « suppression en attente ». Une fois ce délai écoulé, vous ne pouvez plus annuler la suppression. | Valeurs valides : 7 à 30. Valeur par défaut : 30. Unité : jours. |
Policy | Map | Non | Non | Politique de la clé. | Format JSON. Taille maximale : 32 768 octets. Pour plus d'informations sur les politiques de clés, consultez Présentation des politiques de clés. Si vous ne spécifiez pas cette propriété, la politique d'identification par défaut s'applique. Une politique de clé contient les éléments suivants :
Format d'une politique de clé : |
ProtectionLevel | String | Non | Non | Niveau de protection de la clé. | Valeurs valides :
|
RotationInterval | String | Non | Oui | Intervalle de temps pour la rotation automatique des clés. Exemple : | Format : Valeurs valides pour
Les valeurs 7d et 604800s représentent toutes deux un intervalle de 7 jours. Valeurs valides : 7 à 730 jours. |
Tags | List | Non | Oui | Libellés. | Vous pouvez ajouter jusqu'à 20 tags. Pour plus d'informations, consultez Propriété Tags. |
Syntaxe des tags
"Tags": [
{
"Key": String,
"Value": String
}
]
Propriété Tags
|
Nom de la propriété |
Type |
Obligatoire |
Mise à jour possible |
Description |
Contrainte |
|
Key |
String |
Oui |
Non |
Clé du tag. |
Longueur : 1 à 128 caractères. Ne peut pas commencer par |
|
Value |
String |
Non |
Non |
Valeur du tag. |
Longueur : 0 à 128 caractères. Ne peut pas commencer par |
Valeurs de retour
Fn::GetAtt
KeyId : identifiant global unique de la clé.
Exemples
Scénario 1 : Créer une clé KMS à l'aide d'une instance KMS existante
Metadata: {}
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
KMSInstance:
Type: String
Description:
en: KMS Instance Id.
Resources:
KMS-Key-bhs-registry-secret:
Type: ALIYUN::KMS::Key
Properties:
DKMSInstanceId:
Ref: KMSInstance
DeletionProtection: false
Enable: true
EnableAutomaticRotation: true
KeySpec: Aliyun_AES_256
KeyUsage: ENCRYPT/DECRYPT
PendingWindowInDays: 7
RotationInterval: 30d
{
"Metadata": {
},
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"KMSInstance": {
"Type": "String",
"Description": {
"en": "KMS Instance Id."
}
}
},
"Resources": {
"KMS-Key-bhs-registry-secret": {
"Type": "ALIYUN::KMS::Key",
"Properties": {
"DKMSInstanceId": {
"Ref": "KMSInstance"
},
"DeletionProtection": false,
"Enable": true,
"EnableAutomaticRotation": true,
"KeySpec": "Aliyun_AES_256",
"KeyUsage": "ENCRYPT/DECRYPT",
"PendingWindowInDays": 7,
"RotationInterval": "30d"
}
}
}
}Scénario 2 : Créer une instance KMS, puis créer une clé KMS
Metadata: {}
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
ProductVersion:
Type: String
Description:
en: KMS Instance commodity type (software/software-small/hardware/hardware-small).
AllowedValues:
- software
- software-small
- hardware
- hardware-small
Required: true
Resources:
KMSInstance:
Type: ALIYUN::KMS::Instance
Properties:
ProductVersion:
Ref: ProductVersion
KMSKey:
Type: ALIYUN::KMS::Key
Properties:
DKMSInstanceId:
Ref: KMSInstance
DeletionProtection: false
Enable: true
EnableAutomaticRotation: true
KeySpec: Aliyun_AES_256
KeyUsage: ENCRYPT/DECRYPT
PendingWindowInDays: 7
RotationInterval: 30d
KMSAlias:
Type: ALIYUN::KMS::Alias
Properties:
AliasName: bhs-registry-secretDev
KeyId:
Fn::GetAtt:
- KMSKey
- KeyId
{
"Metadata": {
},
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"ProductVersion": {
"Type": "String",
"Description": {
"en": "KMS Instance commodity type (software/software-small/hardware/hardware-small)."
},
"AllowedValues": [
"software",
"software-small",
"hardware",
"hardware-small"
],
"Required": true
}
},
"Resources": {
"KMSInstance": {
"Type": "ALIYUN::KMS::Instance",
"Properties": {
"ProductVersion": {
"Ref": "ProductVersion"
}
}
},
"KMSKey": {
"Type": "ALIYUN::KMS::Key",
"Properties": {
"DKMSInstanceId": {
"Ref": "KMSInstance"
},
"DeletionProtection": false,
"Enable": true,
"EnableAutomaticRotation": true,
"KeySpec": "Aliyun_AES_256",
"KeyUsage": "ENCRYPT/DECRYPT",
"PendingWindowInDays": 7,
"RotationInterval": "30d"
}
},
"KMSAlias": {
"Type": "ALIYUN::KMS::Alias",
"Properties": {
"AliasName": "bhs-registry-secretDev",
"KeyId": {
"Fn::GetAtt": [
"KMSKey",
"KeyId"
]
}
}
}
}
}Pour plus d'exemples, consultez Modèles publics incluant cette ressource.