Namespace Pulumi.AliCloud.PolarDB
Classes
Account
Provides a PolarDB account resource and used to manage databases.
NOTE: Available in v1.67.0+.
AccountArgs
AccountPrivilege
Provides a PolarDB account privilege resource and used to grant several database some access privilege. A database can be granted by multiple account.
NOTE: Available in v1.67.0+.
AccountPrivilegeArgs
AccountPrivilegeState
AccountState
BackupPolicy
BackupPolicyArgs
BackupPolicyState
Cluster
Provides a PolarDB cluster resource. A PolarDB cluster is an isolated database environment in the cloud. A PolarDB cluster can contain multiple user-created databases.
NOTE: Available in v1.66.0+.
Example Usage
Create a PolarDB MySQL cluster
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "polardbClusterconfig";
var creation = config.Get("creation") ?? "PolarDB";
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableResourceCreation = creation,
}));
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
{
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
CidrBlock = "172.16.0.0/24",
VpcId = defaultNetwork.Id,
});
var defaultCluster = new AliCloud.PolarDB.Cluster("defaultCluster", new AliCloud.PolarDB.ClusterArgs
{
DbNodeClass = "rds.mysql.s2.large",
DbType = "MySQL",
DbVersion = "5.6",
Description = name,
PayType = "PostPaid",
VswitchId = defaultSwitch.Id,
});
}
}
ClusterArgs
ClusterState
Database
Provides a PolarDB database resource. A DB database deployed in a DB cluster. A DB cluster can own multiple databases.
NOTE: Available in v1.66.0+.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var cluster = new AliCloud.PolarDB.Cluster("cluster", new AliCloud.PolarDB.ClusterArgs
{
DbNodeClass = @var.Clusterclass,
DbType = "MySQL",
DbVersion = "8.0",
Description = "testDB",
PayType = "PostPaid",
VswitchId = "polar.mysql.x4.large",
});
var @default = new AliCloud.PolarDB.Database("default", new AliCloud.PolarDB.DatabaseArgs
{
DbClusterId = cluster.Id,
DbName = "tftestdatabase",
});
}
}
DatabaseArgs
DatabaseState
Endpoint
Provides a PolarDB endpoint resource to allocate an Internet endpoint string for PolarDB instance.
NOTE: Available in v1.80.0+. Each PolarDB instance will allocate a intranet connection string automatically and its prefix is Cluster ID. To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
EndpointAddress
Provides a PolarDB endpoint address resource to allocate an Internet endpoint address string for PolarDB instance.
NOTE: Available in v1.68.0+. Each PolarDB instance will allocate a intranet connection string automatically and its prefix is Cluster ID. To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var creation = config.Get("creation") ?? "PolarDB";
var name = config.Get("name") ?? "polardbconnectionbasic";
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableResourceCreation = creation,
}));
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
{
CidrBlock = "172.16.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/24",
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
});
var defaultCluster = new AliCloud.PolarDB.Cluster("defaultCluster", new AliCloud.PolarDB.ClusterArgs
{
DbType = "MySQL",
DbVersion = "8.0",
PayType = "PostPaid",
DbNodeClass = "polar.mysql.x4.large",
VswitchId = defaultSwitch.Id,
Description = name,
});
var defaultEndpoints = defaultCluster.Id.Apply(id => AliCloud.PolarDB.GetEndpoints.InvokeAsync(new AliCloud.PolarDB.GetEndpointsArgs
{
DbClusterId = id,
}));
var endpoint = new AliCloud.PolarDB.EndpointAddress("endpoint", new AliCloud.PolarDB.EndpointAddressArgs
{
DbClusterId = defaultCluster.Id,
DbEndpointId = defaultEndpoints.Apply(defaultEndpoints => defaultEndpoints.Endpoints[0].DbEndpointId),
ConnectionPrefix = "testpolardbconn",
NetType = "Public",
});
}
}