All Products
Search
Document Center

:ALIYUN::Bailian::ApiKey

Last Updated:Jul 20, 2026

ALIYUN::Bailian::ApiKey creates a Bailian API key.

Syntax

{
  "Type": "ALIYUN::Bailian::ApiKey",
  "Properties": {
    "AuthSetModel": Map,
    "Description": String
  }
}

Properties

Property

Type

Required

Allow Update

Description

Constraints

AuthSetModel

Map

No

No

The authentication model for this API key.

For more information, see AuthSetModel properties.

Description

String

No

No

The description of the API key.

None

AuthSetModel syntax

"AuthSetModel": {
  "AccessIps": List,
  "AuthSetMode": String
}

AuthSetModel properties

Property

Type

Required

Allow Update

Description

Constraints

AccessIps

List

No

No

The IP addresses for access.

None

AuthSetMode

String

No

No

The mode of the authentication method.

Valid values:

  • Custom

  • All

Return values

Fn::GetAtt

  • ApiKeyId: The ID of the API key.

  • Key: The value of the API key.

Examples

Scenario 1: Create a Bailian API key

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建百炼API-KEY,用于调用通义千问等大模型API。
  en: Create a Bailian API key for calling large model APIs such as Qwen.
Parameters:
  ApiKeyDescription:
    Type: String
    Label:
      zh-cn: API-KEY描述
      en: API Key Description
    Description:
      zh-cn: API-KEY的描述信息,便于识别用途,1~128个字符。
      en: The description of the API key for identification, 1-128 characters.
    Default: 百炼平台大模型API-KEY
Resources:
  BailianApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Ref: ApiKeyDescription
Outputs:
  ApiKeyId:
    Label:
      zh-cn: API-KEY ID
      en: API Key ID
    Description:
      zh-cn: 创建的API-KEY唯一标识ID。
      en: The unique ID of the created API key.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - ApiKeyId
  ApiKey:
    Label:
      zh-cn: API-KEY
      en: API Key
    Description:
      zh-cn: 创建的API-KEY值,用于调用百炼大模型API,请妥善保管。
      en: The value of the created API key for calling Bailian model APIs. Keep it safe.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - Key
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建百炼API-KEY,用于调用通义千问等大模型API。",
    "en": "Create a Bailian API key for calling large model APIs such as Qwen."
  },
  "Parameters": {
    "ApiKeyDescription": {
      "Type": "String",
      "Label": {
        "zh-cn": "API-KEY描述",
        "en": "API Key Description"
      },
      "Description": {
        "zh-cn": "API-KEY的描述信息,便于识别用途,1~128个字符。",
        "en": "The description of the API key for identification, 1-128 characters."
      },
      "Default": "百炼平台大模型API-KEY"
    }
  },
  "Resources": {
    "BailianApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Ref": "ApiKeyDescription"
        }
      }
    }
  },
  "Outputs": {
    "ApiKeyId": {
      "Label": {
        "zh-cn": "API-KEY ID",
        "en": "API Key ID"
      },
      "Description": {
        "zh-cn": "创建的API-KEY唯一标识ID。",
        "en": "The unique ID of the created API key."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "ApiKeyId"
        ]
      }
    },
    "ApiKey": {
      "Label": {
        "zh-cn": "API-KEY",
        "en": "API Key"
      },
      "Description": {
        "zh-cn": "创建的API-KEY值,用于调用百炼大模型API,请妥善保管。",
        "en": "The value of the created API key for calling Bailian model APIs. Keep it safe."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "Key"
        ]
      }
    }
  }
}

Scenario 2: Create a Bailian API key and configure an IP access whitelist to restrict model API calls to specified IP addresses

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建百炼API-KEY并配置IP访问白名单,限制仅指定IP可调用大模型API。
  en: Create a Bailian API key with an IP whitelist to restrict model API access.
Parameters:
  ApiKeyDescription:
    Type: String
    Label:
      zh-cn: API-KEY描述
      en: API Key Description
    Description:
      zh-cn: API-KEY的描述信息,便于识别用途,1~128个字符。
      en: The description of the API key for identification, 1-128 characters.
    Default: 百炼平台大模型API-KEY(IP白名单)
  AuthSetMode:
    Type: String
    Label:
      zh-cn: 访问控制模式
      en: Access Control Mode
    Description:
      zh-cn: >-
        API-KEY的访问控制模式。
        Custom:仅白名单内IP可调用;All:不限制IP。
      en: >-
        The access control mode of the API key.
        Custom: only whitelisted IPs can call; All: no IP restriction.
    Default: Custom
    AllowedValues:
      - Custom
      - All
  AccessIps:
    Type: Json
    Label:
      zh-cn: IP访问白名单
      en: IP Access Whitelist
    Description:
      zh-cn: >-
        允许调用该API-KEY的IP地址或CIDR段列表。
        访问控制模式为Custom时生效,默认0.0.0.0/0表示允许所有IP,请按需收敛。
      en: >-
        The IP addresses or CIDR blocks allowed to call this API key.
        Effective when the access control mode is Custom.
        Default 0.0.0.0/0 allows all IPs; narrow it down as needed.
    Default: ["0.0.0.0/0"]
    AssociationProperty: List[Parameter]
    AssociationPropertyMetadata:
      Parameter:
        Type: String
        Required: true
        Label:
          zh-cn: IP地址
          en: IP Address
Resources:
  BailianApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Ref: ApiKeyDescription
      AuthSetModel:
        AuthSetMode:
          Ref: AuthSetMode
        AccessIps:
          Ref: AccessIps
Outputs:
  ApiKeyId:
    Label:
      zh-cn: API-KEY ID
      en: API Key ID
    Description:
      zh-cn: 创建的API-KEY唯一标识ID。
      en: The unique ID of the created API key.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - ApiKeyId
  ApiKey:
    Label:
      zh-cn: API-KEY
      en: API Key
    Description:
      zh-cn: 创建的API-KEY值,用于调用百炼大模型API,请妥善保管。
      en: The value of the created API key for calling Bailian model APIs. Keep it safe.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - Key
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建百炼API-KEY并配置IP访问白名单,限制仅指定IP可调用大模型API。",
    "en": "Create a Bailian API key with an IP whitelist to restrict model API access."
  },
  "Parameters": {
    "ApiKeyDescription": {
      "Type": "String",
      "Label": {
        "zh-cn": "API-KEY描述",
        "en": "API Key Description"
      },
      "Description": {
        "zh-cn": "API-KEY的描述信息,便于识别用途,1~128个字符。",
        "en": "The description of the API key for identification, 1-128 characters."
      },
      "Default": "百炼平台大模型API-KEY(IP白名单)"
    },
    "AuthSetMode": {
      "Type": "String",
      "Label": {
        "zh-cn": "访问控制模式",
        "en": "Access Control Mode"
      },
      "Description": {
        "zh-cn": "API-KEY的访问控制模式。Custom:仅白名单内IP可调用;All:不限制IP。",
        "en": "The access control mode of the API key. Custom: only whitelisted IPs can call; All: no IP restriction."
      },
      "Default": "Custom",
      "AllowedValues": [
        "Custom",
        "All"
      ]
    },
    "AccessIps": {
      "Type": "Json",
      "Label": {
        "zh-cn": "IP访问白名单",
        "en": "IP Access Whitelist"
      },
      "Description": {
        "zh-cn": "允许调用该API-KEY的IP地址或CIDR段列表。访问控制模式为Custom时生效,默认0.0.0.0/0表示允许所有IP,请按需收敛。",
        "en": "The IP addresses or CIDR blocks allowed to call this API key. Effective when the access control mode is Custom. Default 0.0.0.0/0 allows all IPs; narrow it down as needed."
      },
      "Default": [
        "0.0.0.0/0"
      ],
      "AssociationProperty": "List[Parameter]",
      "AssociationPropertyMetadata": {
        "Parameter": {
          "Type": "String",
          "Required": true,
          "Label": {
            "zh-cn": "IP地址",
            "en": "IP Address"
          }
        }
      }
    }
  },
  "Resources": {
    "BailianApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Ref": "ApiKeyDescription"
        },
        "AuthSetModel": {
          "AuthSetMode": {
            "Ref": "AuthSetMode"
          },
          "AccessIps": {
            "Ref": "AccessIps"
          }
        }
      }
    }
  },
  "Outputs": {
    "ApiKeyId": {
      "Label": {
        "zh-cn": "API-KEY ID",
        "en": "API Key ID"
      },
      "Description": {
        "zh-cn": "创建的API-KEY唯一标识ID。",
        "en": "The unique ID of the created API key."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "ApiKeyId"
        ]
      }
    },
    "ApiKey": {
      "Label": {
        "zh-cn": "API-KEY",
        "en": "API Key"
      },
      "Description": {
        "zh-cn": "创建的API-KEY值,用于调用百炼大模型API,请妥善保管。",
        "en": "The value of the created API key for calling Bailian model APIs. Keep it safe."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "Key"
        ]
      }
    }
  }
}