ShardingInstance

class ShardingInstance : KotlinCustomResource

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-2`,`ap-southeast-3`,`ap-southeast-5`,`ap-south-1`,`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

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.ShardingInstanceShardListArgs;
import com.pulumi.alicloud.mongodb.inputs.ShardingInstanceMongoListArgs;
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 defaultZones = MongodbFunctions.getZones();
final var index = defaultZones.applyValue(getZonesResult -> getZonesResult.zones()).length() - 1;
final var zoneId = defaultZones.applyValue(getZonesResult -> getZonesResult.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()
.zoneId(zoneId)
.vswitchId(defaultSwitch.id())
.engineVersion("4.2")
.shardLists(
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.mid")
.nodeStorage("10")
.build(),
ShardingInstanceShardListArgs.builder()
.nodeClass("dds.shard.standard")
.nodeStorage("20")
.readonlyReplicas("1")
.build())
.mongoLists(
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build(),
ShardingInstanceMongoListArgs.builder()
.nodeClass("dds.mongos.mid")
.build())
.build());
}
}

Module Support

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

Import

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

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

Properties

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

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>?

Auto renew for prepaid, true of false. Default is false.

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

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
val backupTime: Output<String>

MongoDB 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 node information list of config server. See config_server_list below.

Link copied to clipboard
val engineVersion: Output<String>

Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Valid values are PrePaid, PostPaid,System default to PostPaid. NOTE: It can be modified from PostPaid to PrePaid after version v1.141.0.

Link copied to clipboard

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

Link copied to clipboard

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-node count can be purchased is in range of 2, 32. See mongo_list below.

Link copied to clipboard
val name: Output<String>

The name of DB instance. It a string of 2 to 256 characters.

Link copied to clipboard
val networkType: Output<String>

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

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

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

Link copied to clipboard
val period: Output<Int>

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

Link copied to clipboard
val protocolType: Output<String>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceGroupId: Output<String>

The ID of the Resource Group.

Link copied to clipboard
val retentionPeriod: Output<Int>

Instance log backup retention days. NOTE: Available in 1.42.0+.

Link copied to clipboard
val securityGroupId: Output<String>

The Security Group ID of ECS.

Link copied to clipboard

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-node count can be purchased is in range of 2, 32. See shard_list below.

Link copied to clipboard
val storageEngine: Output<String>

Storage engine: WiredTiger or RocksDB. System Default value: WiredTiger.

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

A mapping of tags to assign to the resource.

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

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

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

The ID of the VPC. NOTE: This parameter is valid only when NetworkType is set to VPC.

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

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

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

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.