全部產品
Search
文件中心

:ALIYUN::KMS::Secret

更新時間:Dec 26, 2025

ALIYUN::KMS::Secret類型用於建立憑據,並存入憑據的初始版本。

文法

{
  "Type": "ALIYUN::KMS::Secret",
  "Properties": {
    "VersionId": String,
    "SecretName": String,
    "Description": String,
    "SecretDataType": String,
    "SecretData": String,
    "VersionStages": List,
    "EncryptionKeyId": String,
    "RecoveryWindowInDays": Integer,
    "ForceDeleteWithoutRecovery": Boolean,
    "SecretType": String,
    "EnableAutomaticRotation": Boolean,
    "RotationInterval": String,
    "ExtendedConfig": Map,
    "DKMSInstanceId": String,
    "Policy": Map,
    "Tags": List
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

VersionId

String

初始版本的版本號碼。

憑據對象內版本號碼唯一。

SecretName

String

憑據名稱。

Description

String

憑據的描述資訊。

SecretDataType

String

憑據實值型別。

取值:

  • text

  • binary

SecretData

String

新建立憑據的憑據值。憑據管家將其加密後,存入初始版本中。

VersionStages

List

版本的狀態標記。

預設標記:ACSCurrent。

最多指定7個標記。

EncryptionKeyId

String

用於加密保護憑據值的KMS主要金鑰的標識符。

如果不指定,則憑據管家使用系統建立的密鑰來加密保護憑據資料。

說明

KMS主要金鑰必須是對稱金鑰。

RecoveryWindowInDays

Integer

按照可恢複的方式刪除憑據,且指定可恢複的視窗。

預設值:30。

單位:天。

ForceDeleteWithoutRecovery

Boolean

是否強制移除憑據,且不允許恢複。

取值:

  • true:強制移除憑據,且不允許恢複。

  • false(預設值):非強制移除憑據,允許恢複。

SecretType

String

憑據類型。

取值:

  • Generic:普通憑據。

  • Rds:託管RDS憑據。

  • RAMCredentials:託管RAM憑據。

  • ECS:託管ECS憑據。

EnableAutomaticRotation

Boolean

是否開啟自動密鑰輪轉。

取值:

  • true:開啟自動密鑰輪轉。

  • false(預設值):關閉自動密鑰輪轉。

RotationInterval

String

憑據自動輪轉的周期。

格式為integer[unit],其中integer表示時間長度,unit表示時間單位。unit取值:s(秒)。例如:7天的輪轉周期為604800s。

說明

當自動輪轉開啟時,返回該參數。

ExtendedConfig

Map

憑據的拓展配置。

Policy

Map

密鑰策略。

JSON格式。最大長度為32768個位元組。

關於密鑰策略的詳細介紹,請參見密鑰策略概述。不輸入該參數時,使用預設憑據策略。

密鑰策略內容包含:

  • Version:密鑰策略的版本,目前版本僅支援設定為1。

  • Statement:密鑰策略的語句,每個密鑰策略包含一個或多個語句。

密鑰策略格式為:

{
    "Version": "1",
    "Statement": [
        {
            "Sid": "Enable RAM User Permissions",
            "Effect": "Allow",
            "Principal": {
              "RAM": "acs:ram::112890462****:root"
            }
            "Action": [
                "kms:*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Tags

List

標籤。

最多支援添加20個標籤。

更多資訊,請參見Tags屬性

DKMSInstanceId

String

專屬KMS的執行個體ID。

Tags文法

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

標籤鍵。

長度為1~128個字元,不能以aliyunacs:開頭,不能包含http://或者https://

Value

String

標籤值。

長度為0~128個字元,不能以aliyunacs:開頭,不能包含http://或者https://

傳回值

Fn::GetAtt

  • SecretName:憑據名稱。

  • Arn:阿里雲資源名稱。

樣本

ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
  Secret:
    Type: ALIYUN::KMS::Secret
    Properties:
      VersionId: v1
      SecretName: TestSecret
      SecretData: DemoSecretData
      ForceDeleteWithoutRecovery: false
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
  },
  "Resources": {
    "Secret": {
      "Type": "ALIYUN::KMS::Secret",
      "Properties": {
        "VersionId": "v1",
        "SecretName": "TestSecret",
        "SecretData": "DemoSecretData",
        "ForceDeleteWithoutRecovery": false
      }
    }
  },
  "Outputs": {
  }
}