ALIYUN::KMS::Key リソースはマスターキーを作成します。
構文
{
"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
}
}プロパティ
プロパティ名 | タイプ | 必須 | 更新可能 | 説明 | 制約 |
DKMSInstanceId | String | いいえ | いいえ | ご利用の専用 KMS のインスタンス ID。 | 既存の KMS は専用 KMS にアップグレードされます。アップグレードの詳細については、「[アップグレード通知] KMS は専用 KMS にアップグレードされます」をご参照ください。 |
DeletionProtection | Boolean | いいえ | はい | 削除保護を有効にするかどうかを指定します。 | 有効値:
|
Description | String | いいえ | はい | キーの説明。 | 説明は 0~8192 文字である必要があります。 |
Enable | Boolean | いいえ | はい | キーを有効にするか無効にするかを指定します。 | 有効値:
|
KeyUsage | String | いいえ | いいえ | キーの用途。 | 有効値:
デフォルト値: キーが署名検証をサポートしている場合は SIGN/VERIFY。それ以外の場合、デフォルト値は ENCRYPT/DECRYPT です。 |
EnableAutomaticRotation | Boolean | いいえ | はい | キーの自動ローテーションを有効にするかどうかを指定します。 | 有効値:
|
KeySpec | String | いいえ | いいえ | キーのタイプ。 | 有効値:
説明 中国本土では、マネージド HSM を使用して作成されたキーのデフォルトは Aliyun_SM4 です。それ以外のすべての場合、キーのデフォルトは Aliyun_AES_256 です。 |
PendingWindowInDays | Integer | いいえ | いいえ | 削除保留期間。この期間中、削除保留中のキーの削除を取り消すことができます。この期間が終了すると、削除を取り消すことはできません。 | 有効値:7~30。 デフォルト値:30。 単位:日。 |
Policy | Map | いいえ | いいえ | キーポリシー。 | JSON 形式。最大サイズ:32768 バイト。 キーポリシーの詳細については、「キーポリシーの概要」をご参照ください。このプロパティを指定しない場合、デフォルトの認証情報ポリシーが使用されます。 キーポリシーには、次の要素が含まれます:
キーポリシーの形式は次のとおりです: |
ProtectionLevel | String | いいえ | いいえ | キーの保護レベル。 | 有効値:
|
RotationInterval | String | いいえ | はい | キーの自動ローテーションの時間間隔。例: | 形式は
7d と 604800s はどちらも 7 日間の間隔を表します。 有効値:7~730 日。 |
Tags | List | いいえ | はい | ラベル。 | 最大 20 個のタグを追加できます。 詳細については、「Tags プロパティ」をご参照ください。 |
Tags 構文
"Tags": [
{
"Key": String,
"Value": String
}
]Tags プロパティ
プロパティ名 | タイプ | 必須 | 更新を有効化する | 説明 | 制約 |
Key | String | はい | いいえ | タグキー。 | 長さ:1~128 文字。 |
Value | String | いいえ | いいえ | タグ値。 | 長さ:0~128 文字。 |
戻り値
Fn::GetAtt
KeyId: キーのグローバル一意識別子。
例
シナリオ 1: 既存の KMS インスタンスを使用した KMS キーの作成
Metadata: {}
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
KMSInstance:
Type: String
Description:
en: KMS インスタンス 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 インスタンス 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"
}
}
}
}シナリオ 2: KMS インスタンスの作成とそれに続く KMS キーの作成
Metadata: {}
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
ProductVersion:
Type: String
Description:
en: KMS インスタンスの商品タイプ (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 インスタンスの商品タイプ (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"
]
}
}
}
}
}その他の例については、「このリソースを含むパブリックテンプレート」をご参照ください。