Todos os produtos
Search
Central de documentação

:ALIYUN::MONGODB::ServerlessInstance

Última atualização: Jun 27, 2026

O recurso ALIYUN::MONGODB::ServerlessInstance cria uma instância do ApsaraDB for MongoDB (Serverless).

Sintaxe

{
  "Type": "ALIYUN::MONGODB::ServerlessInstance",
  "Properties": {
    "EngineVersion": String,
    "ZoneId": String,
    "ResourceGroupId": String,
    "AutoRenew": Boolean,
    "VSwitchId": String,
    "PeriodPriceType": String,
    "Period": Integer,
    "SecurityIPArray": String,
    "StorageEngine": String,
    "AccountPassword": String,
    "VpcId": String,
    "ChargeType": String,
    "NetworkType": String,
    "DBInstanceStorage": Integer,
    "DBInstanceDescription": String,
    "TDEStatus": Boolean
    "Tags": List
  }
}

Propriedades

PropriedadeTipoObrigatóriaEditávelDescriçãoRestrição
EngineVersionStringNãoNãoVersão do mecanismo da instância. Defina como 4.2.
ZoneIdStringNãoNãoID da zona. Nenhuma
ResourceGroupIdStringNãoSimID do grupo de recursos. Nenhuma
AutoRenewBooleanNãoNãoDefine se a renovação automática está ativada para a instância. Valor padrão: false. Valores válidos:
  • true: ativa a renovação automática da instância.
  • false: não ativa a renovação automática da instância.
VSwitchIdStringNãoNãoID do vSwitch. Nenhuma
PeriodPriceTypeStringNãoNãoUnidade do ciclo de faturamento. Valores válidos:
  • Day
  • Month
PeriodIntegerNãoNãoDuração da assinatura da instância.
  • Se PeriodPriceType for Day: 1, 7 e 14.
  • Se PeriodPriceType for Month: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36 e 60.

Unidade: meses.

SecurityIPArrayStringNãoNãoEndereços IP na lista de permissões da instância. Separe vários endereços IP com vírgulas (,). Cada endereço IP deve ser único na lista de permissões, que aceita até 1.000 entradas.

Insira endereços IP como 10.23.XX.XX ou blocos CIDR como 10.23.XX.XX/24. O sufixo /24 indica prefixo de 24 bits; substitua 24 por qualquer valor entre 1 e 32. Também é permitido usar o sinal de porcentagem (%) ou 0.0.0.0/0.

Nota O uso de % ou 0.0.0.0/0 permite acesso de qualquer endereço IP à instância, o que gera riscos de segurança. Proceda com cautela.
StorageEngineStringNãoNãoMecanismo de armazenamento da instância. Defina como WiredTiger.

Para mais informações sobre mecanismos de armazenamento e versões do MongoDB, consulte Versões e mecanismos de armazenamento.

AccountPasswordStringNãoSimSenha de conexão ao banco de dados. A senha deve ter de 8 a 32 caracteres.

Deve conter pelo menos três dos seguintes tipos: letras maiúsculas, letras minúsculas, dígitos e caracteres especiais. Os caracteres especiais incluem ! # $ % ^ \ & * ( ) _ + - =.

Nota Instâncias do ApsaraDB for MongoDB (Serverless) possuem uma conta de login padrão no banco de dados. Não é possível alterar a conta, mas você pode modificar a senha.
VpcIdStringNãoNãoID da Virtual Private Cloud (VPC). Nenhuma
ChargeTypeStringNãoNãoMétodo de faturamento da instância. Defina como PrePaid.
NetworkTypeStringNãoNãoTipo de rede da instância. Instâncias do ApsaraDB for MongoDB (Serverless) exigem rede VPC. Defina como VPC.
DBInstanceStorageIntegerSimNãoCapacidade de armazenamento da instância. Valores válidos: 1 a 10.

Unidade: GB.

DBInstanceDescriptionStringNãoNãoDescrição da instância. Deve ter de 2 a 256 caracteres e pode conter letras, dígitos, sublinhados (_) e hifens (-).

Deve começar com uma letra.

TDEStatusBooleanNãoSimDefine se a Criptografia Transparente de Dados (TDE) está ativada. Valor padrão: false. Valores válidos:
  • true: ativa o TDE.
    Nota Não é possível desativar o TDE após a ativação.
  • false: não ativa o TDE.
TagsListNãoSimTags da instância. Limite de 20 tags.

Para mais informações, consulte Propriedades de Tags.

Sintaxe de Tags

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

Propriedades de Tags

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Key

String

Sim

Não

Chave da tag.

Deve ter de 1 a 128 caracteres e não pode conter http:// ou https://. Não pode começar com acs: ou aliyun.

Value

String

Não

Não

Valor da tag.

Deve ter de 0 a 128 caracteres e não pode conter http:// ou https://. Não pode começar com acs: ou aliyun.

Valores de retorno

Fn::GetAtt

  • DBInstanceStatus: status da instância.

  • DBInstanceId: ID da instância.

  • ConnectionURI: string de conexão da instância.

  • OrderId: ID do pedido.

Exemplos

Formato JSON

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "TDEStatus": {
      "Type": "Boolean",
      "Description": "Specifies whether to enable Transparent Data Encryption (TDE). Valid values:\ntrue: enable TDE\nfalse: disable TDE (default)\nNote: You cannot disable TDE after it is enabled. ",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "EngineVersion": {
      "Type": "String",
      "Description": "Database instance version.Support 4.2",
      "Default": "4.2"
    },
    "ZoneId": {
      "Type": "String",
      "Description": "On which zone to create the instance. If VpcId and VSwitchId is specified, ZoneId is required and VSwitch should be in same zone."
    },
    "ResourceGroupId": {
      "Type": "String",
      "Description": "The ID of the resource group."
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The vSwitch Id to create mongodb instance."
    },
    "AutoRenew": {
      "Type": "Boolean",
      "Description": "Indicates whether automatic renewal is enabled for the instance. Valid values:true: Automatic renewal is enabled.false: Automatic renewal is not enabled. You must renew the instance manually.Default value: false.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "Period": {
      "Type": "Number",
      "Description": "The subscription period of the instance.Default Unit: Month.Valid values: [1~9], 12, 24, 36. Default to 1.",
      "AllowedValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        12,
        24,
        36
      ],
      "Default": 1
    },
    "SecurityIPArray": {
      "Type": "String",
      "Description": "Security ips to add or remove."
    },
    "StorageEngine": {
      "Type": "String",
      "Description": "Database storage engine.Support WiredTiger",
      "AllowedValues": [
        "WiredTiger"
      ],
      "Default": "WiredTiger"
    },
    "AccountPassword": {
      "Type": "String",
      "Description": "Root account password, can contain the letters, numbers or underscores the composition, length of 6~32 bit."
    },
    "VpcId": {
      "Type": "String",
      "Description": "The VPC id to create mongodb instance."
    },
    "ChargeType": {
      "Type": "String",
      "Description": "The billing method of the instance.values:PostPaid: Pay-As-You-Go.PrePaid: Subscription.Default value: PostPaid",
      "AllowedValues": [
        "Subscription",
        "PrePaid",
        "PrePay",
        "Prepaid",
        "PayAsYouGo",
        "PostPaid",
        "PayOnDemand",
        "Postpaid"
      ],
      "Default": "PostPaid"
    },
    "NetworkType": {
      "Type": "String",
      "Description": "The instance network type. Support 'CLASSIC' and 'VPC' only, default is 'CLASSIC'.",
      "AllowedValues": [
        "CLASSIC",
        "VPC"
      ]
    },
    "DBInstanceStorage": {
      "Type": "Number",
      "Description": "Database instance storage size. MongoDB is [1.10], increased every 1 GB, Unit in GB"
    },
    "PeriodPriceType": {
      "Type": "String",
      "Description": "Charge period for created instance.",
      "AllowedValues": [
        "Day",
        "Month"
      ]
    },
    "DBInstanceDescription": {
      "Type": "String",
      "Description": "Description of created database instance."
    },
    "Tags": {
      "Type": "Json",
      "Description": "Tags to attach to instance. Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.",
      "MaxLength": 20
    }
  },
  "Resources": {
    "MongoDbServerlessInstance": {
      "Type": "ALIYUN::MONGODB::ServerlessInstance",
      "Properties": {
        "TDEStatus": {
          "Ref": "TDEStatus"
        },
        "EngineVersion": {
          "Ref": "EngineVersion"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "AutoRenew": {
          "Ref": "AutoRenew"
        },
        "Period": {
          "Ref": "Period"
        },
        "SecurityIPArray": {
          "Ref": "SecurityIPArray"
        },
        "StorageEngine": {
          "Ref": "StorageEngine"
        },
        "AccountPassword": {
          "Ref": "AccountPassword"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "ChargeType": {
          "Ref": "ChargeType"
        },
        "NetworkType": {
          "Ref": "NetworkType"
        },
        "DBInstanceStorage": {
          "Ref": "DBInstanceStorage"
        },
        "PeriodPriceType": {
          "Ref": "PeriodPriceType"
        },
        "DBInstanceDescription": {
          "Ref": "DBInstanceDescription"
        },
        "Tags": {
          "Ref": "Tags"
        }
      }
    }
  },
  "Outputs": {
    "DBInstanceStatus": {
      "Description": "Status of mongodb instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbServerlessInstance",
          "DBInstanceStatus"
        ]
      }
    },
    "DBInstanceId": {
      "Description": "The instance id of created mongodb instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbServerlessInstance",
          "DBInstanceId"
        ]
      }
    },
    "ConnectionURI": {
      "Description": "Connection uri.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbServerlessInstance",
          "ConnectionURI"
        ]
      }
    },
    "OrderId": {
      "Description": "Order Id of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbServerlessInstance",
          "OrderId"
        ]
      }
    }
  }
}

Formato YAML

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AccountPassword:
    Description: Root account password, can contain the letters, numbers or underscores
      the composition, length of 6~32 bit.
    Type: String
  AutoRenew:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Description: 'Indicates whether automatic renewal is enabled for the instance.
      Valid values:true: Automatic renewal is enabled.false: Automatic renewal is
      not enabled. You must renew the instance manually.Default value: false.'
    Type: Boolean
  ChargeType:
    AllowedValues:
    - Subscription
    - PrePaid
    - PrePay
    - Prepaid
    - PayAsYouGo
    - PostPaid
    - PayOnDemand
    - Postpaid
    Default: PostPaid
    Description: 'The billing method of the instance.values:PostPaid: Pay-As-You-Go.PrePaid:
      Subscription.Default value: PostPaid'
    Type: String
  DBInstanceDescription:
    Description: Description of created database instance.
    Type: String
  DBInstanceStorage:
    Description: Database instance storage size. MongoDB is [1,10], increased every
      1 GB, Unit in GB
    Type: Number
  EngineVersion:
    Default: '4.2'
    Description: Database instance version.Support 4.2
    Type: String
  NetworkType:
    AllowedValues:
    - CLASSIC
    - VPC
    Description: The instance network type. Support 'CLASSIC' and 'VPC' only, default
      is 'CLASSIC'.
    Type: String
  Period:
    AllowedValues:
    - 1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    - 12
    - 24
    - 36
    Default: 1
    Description: 'The subscription period of the instance.Default Unit: Month.Valid
      values: [1~9], 12, 24, 36. Default to 1.'
    Type: Number
  PeriodPriceType:
    AllowedValues:
    - Day
    - Month
    Description: Charge period for created instance.
    Type: String
  ResourceGroupId:
    Description: The ID of the resource group.
    Type: String
  SecurityIPArray:
    Description: Security ips to add or remove.
    Type: String
  StorageEngine:
    AllowedValues:
    - WiredTiger
    Default: WiredTiger
    Description: Database storage engine.Support WiredTiger
    Type: String
  TDEStatus:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Description: 'Specifies whether to enable Transparent Data Encryption (TDE). Valid
      values:

      true: enable TDE

      false: disable TDE (default)

      Note: You cannot disable TDE after it is enabled. '
    Type: Boolean
  Tags:
    Description: Tags to attach to instance. Max support 20 tags to add during create
      instance. Each tag with two properties Key and Value, and Key is required.
    MaxLength: 20
    Type: Json
  VSwitchId:
    Description: The vSwitch Id to create mongodb instance.
    Type: String
  VpcId:
    Description: The VPC id to create mongodb instance.
    Type: String
  ZoneId:
    Description: On which zone to create the instance. If VpcId and VSwitchId is specified,
      ZoneId is required and VSwitch should be in same zone.
    Type: String
Resources:
  MongoDbServerlessInstance:
    Properties:
      AccountPassword:
        Ref: AccountPassword
      AutoRenew:
        Ref: AutoRenew
      ChargeType:
        Ref: ChargeType
      DBInstanceDescription:
        Ref: DBInstanceDescription
      DBInstanceStorage:
        Ref: DBInstanceStorage
      EngineVersion:
        Ref: EngineVersion
      NetworkType:
        Ref: NetworkType
      Period:
        Ref: Period
      PeriodPriceType:
        Ref: PeriodPriceType
      ResourceGroupId:
        Ref: ResourceGroupId
      SecurityIPArray:
        Ref: SecurityIPArray
      StorageEngine:
        Ref: StorageEngine
      TDEStatus:
        Ref: TDEStatus
      Tags:
        Ref: Tags
      VSwitchId:
        Ref: VSwitchId
      VpcId:
        Ref: VpcId
      ZoneId:
        Ref: ZoneId
    Type: ALIYUN::MONGODB::ServerlessInstance
Outputs:
  ConnectionURI:
    Description: Connection uri.
    Value:
      Fn::GetAtt:
      - MongoDbServerlessInstance
      - ConnectionURI
  DBInstanceId:
    Description: The instance id of created mongodb instance.
    Value:
      Fn::GetAtt:
      - MongoDbServerlessInstance
      - DBInstanceId
  DBInstanceStatus:
    Description: Status of mongodb instance.
    Value:
      Fn::GetAtt:
      - MongoDbServerlessInstance
      - DBInstanceStatus
  OrderId:
    Description: Order Id of created instance.
    Value:
      Fn::GetAtt:
      - MongoDbServerlessInstance
      - OrderId
            

Para visualizar mais exemplos, visite ServerlessInstance.json e ServerlessInstance.yml.