ShardingInstanceArgs

data class ShardingInstanceArgs(val accountPassword: Output<String>? = null, val autoRenew: Output<Boolean>? = null, val backupPeriods: Output<List<String>>? = null, val backupRetentionPolicyOnClusterDeletion: Output<Int>? = null, val backupTime: Output<String>? = null, val configServerLists: Output<List<ShardingInstanceConfigServerListArgs>>? = null, val engineVersion: Output<String>? = null, val instanceChargeType: Output<String>? = null, val kmsEncryptedPassword: Output<String>? = null, val kmsEncryptionContext: Output<Map<String, String>>? = null, val mongoLists: Output<List<ShardingInstanceMongoListArgs>>? = null, val name: Output<String>? = null, val networkType: Output<String>? = null, val orderType: Output<String>? = null, val period: Output<Int>? = null, val protocolType: Output<String>? = null, val provisionedIops: Output<Int>? = null, val resourceGroupId: Output<String>? = null, val securityGroupId: Output<String>? = null, val securityIpLists: Output<List<String>>? = null, val shardLists: Output<List<ShardingInstanceShardListArgs>>? = null, val storageEngine: Output<String>? = null, val storageType: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val tdeStatus: Output<String>? = null, val vpcId: Output<String>? = null, val vswitchId: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<ShardingInstanceArgs>

Provides a MongoDB Sharding Instance resource supports replica set instances only. the MongoDB provides stable, reliable, and automatic scalable database services. It offers a full range of database solutions, such as disaster recovery, backup, recovery, monitoring, and alarms. You can see detail product introduction here

NOTE: Available since v1.40.0. NOTE: The following regions don't support create Classic network MongoDB Sharding Instance. `cn-zhangjiakou`,`cn-huhehaote`,`ap-southeast-3`,`ap-southeast-5`,`me-east-1`,`ap-northeast-1`,`eu-west-1` NOTE: Create MongoDB Sharding instance or change instance type and storage would cost 10~20 minutes. Please make full preparation.

Example Usage

Create a Mongodb Sharding instance

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.mongodb.getZones({});
const index = _default.then(_default => _default.zones).length.apply(length => length - 1);
const zoneId = _default.then(_default => _default.zones[index].id);
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "172.17.3.0/24",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vswitchName: name,
cidrBlock: "172.17.3.0/24",
vpcId: defaultNetwork.id,
zoneId: zoneId,
});
const defaultShardingInstance = new alicloud.mongodb.ShardingInstance("default", {
engineVersion: "4.2",
vswitchId: defaultSwitch.id,
zoneId: zoneId,
name: name,
mongoLists: [
{
nodeClass: "dds.mongos.mid",
},
{
nodeClass: "dds.mongos.mid",
},
],
shardLists: [
{
nodeClass: "dds.shard.mid",
nodeStorage: 10,
},
{
nodeClass: "dds.shard.standard",
nodeStorage: 20,
readonlyReplicas: 1,
},
],
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.mongodb.get_zones()
index = len(default.zones).apply(lambda length: length - 1)
zone_id = default.zones[index].id
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="172.17.3.0/24")
default_switch = alicloud.vpc.Switch("default",
vswitch_name=name,
cidr_block="172.17.3.0/24",
vpc_id=default_network.id,
zone_id=zone_id)
default_sharding_instance = alicloud.mongodb.ShardingInstance("default",
engine_version="4.2",
vswitch_id=default_switch.id,
zone_id=zone_id,
name=name,
mongo_lists=[
{
"node_class": "dds.mongos.mid",
},
{
"node_class": "dds.mongos.mid",
},
],
shard_lists=[
{
"node_class": "dds.shard.mid",
"node_storage": 10,
},
{
"node_class": "dds.shard.standard",
"node_storage": 20,
"readonly_replicas": 1,
},
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.MongoDB.GetZones.Invoke();
var index = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones)).Length.Apply(length => length - 1);
var zoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones)[index].Id);
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "172.17.3.0/24",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VswitchName = name,
CidrBlock = "172.17.3.0/24",
VpcId = defaultNetwork.Id,
ZoneId = zoneId,
});
var defaultShardingInstance = new AliCloud.MongoDB.ShardingInstance("default", new()
{
EngineVersion = "4.2",
VswitchId = defaultSwitch.Id,
ZoneId = zoneId,
Name = name,
MongoLists = new[]
{
new AliCloud.MongoDB.Inputs.ShardingInstanceMongoListArgs
{
NodeClass = "dds.mongos.mid",
},
new AliCloud.MongoDB.Inputs.ShardingInstanceMongoListArgs
{
NodeClass = "dds.mongos.mid",
},
},
ShardLists = new[]
{
new AliCloud.MongoDB.Inputs.ShardingInstanceShardListArgs
{
NodeClass = "dds.shard.mid",
NodeStorage = 10,
},
new AliCloud.MongoDB.Inputs.ShardingInstanceShardListArgs
{
NodeClass = "dds.shard.standard",
NodeStorage = 20,
ReadonlyReplicas = 1,
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mongodb"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := mongodb.GetZones(ctx, &mongodb.GetZonesArgs{}, nil)
if err != nil {
return err
}
index := len(_default.Zones).ApplyT(func(length int) (float64, error) {
return length - 1, nil
}).(pulumi.Float64Output)
zoneId := _default.Zones[index].Id
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("172.17.3.0/24"),
VpcId: defaultNetwork.ID(),
ZoneId: pulumi.String(zoneId),
})
if err != nil {
return err
}
_, err = mongodb.NewShardingInstance(ctx, "default", &mongodb.ShardingInstanceArgs{
EngineVersion: pulumi.String("4.2"),
VswitchId: defaultSwitch.ID(),
ZoneId: pulumi.String(zoneId),
Name: pulumi.String(name),
MongoLists: mongodb.ShardingInstanceMongoListArray{
&mongodb.ShardingInstanceMongoListArgs{
NodeClass: pulumi.String("dds.mongos.mid"),
},
&mongodb.ShardingInstanceMongoListArgs{
NodeClass: pulumi.String("dds.mongos.mid"),
},
},
ShardLists: mongodb.ShardingInstanceShardListArray{
&mongodb.ShardingInstanceShardListArgs{
NodeClass: pulumi.String("dds.shard.mid"),
NodeStorage: pulumi.Int(10),
},
&mongodb.ShardingInstanceShardListArgs{
NodeClass: pulumi.String("dds.shard.standard"),
NodeStorage: pulumi.Int(20),
ReadonlyReplicas: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.mongodb.MongodbFunctions;
import com.pulumi.alicloud.mongodb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.mongodb.ShardingInstance;
import com.pulumi.alicloud.mongodb.ShardingInstanceArgs;
import com.pulumi.alicloud.mongodb.inputs.ShardingInstanceMongoListArgs;
import com.pulumi.alicloud.mongodb.inputs.ShardingInstanceShardListArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = MongodbFunctions.getZones(GetZonesArgs.builder()
.build());
final var index = default_.zones().length().applyValue(_length -> _length - 1);
final var zoneId = default_.zones()[index].id();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.17.3.0/24")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("172.17.3.0/24")
.vpcId(defaultNetwork.id())
.zoneId(zoneId)
.build());
var defaultShardingInstance = new ShardingInstance("defaultShardingInstance", ShardingInstanceArgs.builder()
.engineVersion("4.2")
.vswitchId(defaultSwitch.id())
.zoneId(zoneId)
.name(name)
.mongoLists(
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build(),
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build())
.shardLists(
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.mid")
.nodeStorage(10)
.build(),
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.standard")
.nodeStorage(20)
.readonlyReplicas(1)
.build())
.build());
}
}

Module Support

You can use to the existing mongodb-sharding module to create a MongoDB Sharding Instance resource one-click.

Import

MongoDB Sharding Instance can be imported using the id, e.g.

$ pulumi import alicloud:mongodb/shardingInstance:ShardingInstance example dds-bp1291daeda44195

Constructors

Link copied to clipboard
constructor(accountPassword: Output<String>? = null, autoRenew: Output<Boolean>? = null, backupPeriods: Output<List<String>>? = null, backupRetentionPolicyOnClusterDeletion: Output<Int>? = null, backupTime: Output<String>? = null, configServerLists: Output<List<ShardingInstanceConfigServerListArgs>>? = null, engineVersion: Output<String>? = null, instanceChargeType: Output<String>? = null, kmsEncryptedPassword: Output<String>? = null, kmsEncryptionContext: Output<Map<String, String>>? = null, mongoLists: Output<List<ShardingInstanceMongoListArgs>>? = null, name: Output<String>? = null, networkType: Output<String>? = null, orderType: Output<String>? = null, period: Output<Int>? = null, protocolType: Output<String>? = null, provisionedIops: Output<Int>? = null, resourceGroupId: Output<String>? = null, securityGroupId: Output<String>? = null, securityIpLists: Output<List<String>>? = null, shardLists: Output<List<ShardingInstanceShardListArgs>>? = null, storageEngine: Output<String>? = null, storageType: Output<String>? = null, tags: Output<Map<String, String>>? = null, tdeStatus: Output<String>? = null, vpcId: Output<String>? = null, vswitchId: Output<String>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val accountPassword: Output<String>? = null

Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.

Link copied to clipboard
val autoRenew: Output<Boolean>? = null

Auto renew for prepaid. Default value: false. Valid values: true, false.

Link copied to clipboard
val backupPeriods: Output<List<String>>? = null

MongoDB Instance backup period. It is required when backup_time was existed. Valid values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday. Default to Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

Link copied to clipboard

The backup retention policy configured for the instance. Valid values:

Link copied to clipboard
val backupTime: Output<String>? = null

Sharding Instance backup time. It is required when backup_period was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".

Link copied to clipboard

The ConfigServer nodes of the instance. See config_server_list below.

Link copied to clipboard
val engineVersion: Output<String>? = null

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion. NOTE: From version 1.225.1, engine_version can be modified.

Link copied to clipboard
val instanceChargeType: Output<String>? = null

The billing method of the instance. Default value: PostPaid. Valid values: PrePaid, PostPaid. NOTE: It can be modified from PostPaid to PrePaid after version v1.141.0.

Link copied to clipboard
val kmsEncryptedPassword: Output<String>? = null

An KMS encrypts password used to a instance. If the account_password is filled in, this field will be ignored.

Link copied to clipboard
val kmsEncryptionContext: Output<Map<String, String>>? = null

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating instance with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

Link copied to clipboard

The Mongo nodes of the instance. The mongo-node count can be purchased is in range of 2, 32. See mongo_list below.

Link copied to clipboard
val name: Output<String>? = null

The name of DB instance. It must be 2 to 256 characters in length.

Link copied to clipboard
val networkType: Output<String>? = null

The network type of the instance. Valid values:Classic or VPC.

Link copied to clipboard
val orderType: Output<String>? = null

The type of configuration changes performed. Default value: DOWNGRADE. Valid values:

Link copied to clipboard
val period: Output<Int>? = null

The duration that you will buy DB instance (in month). It is valid when instance_charge_type is PrePaid. Default value: 1. Valid values: 1~9, 12, 24, 36.

Link copied to clipboard
val protocolType: Output<String>? = null

The type of the access protocol. Valid values: mongodb or dynamodb.

Link copied to clipboard
val provisionedIops: Output<Int>? = null

The provisioned IOPS. Valid values: 0 to 50000.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the Resource Group.

Link copied to clipboard
val securityGroupId: Output<String>? = null

The Security Group ID of ECS.

Link copied to clipboard
val securityIpLists: Output<List<String>>? = null

List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is 1,32). System default to ["127&#46;0&#46;0&#46;1"].

Link copied to clipboard

The Shard nodes of the instance. The shard-node count can be purchased is in range of 2, 32. See shard_list below.

Link copied to clipboard
val storageEngine: Output<String>? = null

The storage engine of the instance. Default value: WiredTiger. Valid values: WiredTiger, RocksDB.

Link copied to clipboard
val storageType: Output<String>? = null

The storage type of the instance. Valid values: cloud_essd1, cloud_essd2, cloud_essd3, cloud_auto, local_ssd. NOTE: From version 1.229.0, storage_type can be modified. However, storage_type can only be modified to cloud_auto.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val tdeStatus: Output<String>? = null

The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.

Link copied to clipboard
val vpcId: Output<String>? = null

The ID of the VPC. NOTE: vpc_id is valid only when network_type is set to VPC.

Link copied to clipboard
val vswitchId: Output<String>? = null

The virtual switch ID to launch DB instances in one VPC.

Link copied to clipboard
val zoneId: Output<String>? = null

The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone. If it is a multi-zone and vswitch_id is specified, the vswitch must in one of them.

Functions

Link copied to clipboard
open override fun toJava(): ShardingInstanceArgs