Alibaba Cloud

v3.10.0 published on Wednesday, Nov 24, 2021 by Pulumi

Instance

Provides a AnalyticDB for PostgreSQL instance resource supports replica set instances only. the AnalyticDB for PostgreSQL provides stable, reliable, and automatic scalable database services. You can see detail product introduction here

NOTE: Available in 1.47.0+

NOTE: The following regions don’t support create Classic network Gpdb instance. [ap-southeast-2,ap-southeast-3,ap-southeast-5,ap-south-1,me-east-1,ap-northeast-1,eu-west-1,us-east-1,eu-central-1,cn-shanghai-finance-1,cn-shenzhen-finance-1,cn-hangzhou-finance]

NOTE: Create instance or change instance would cost 10~15 minutes. Please make full preparation.

NOTE: This resource is used to manage a Reserved Storage Mode instance, and creating a new reserved storage mode instance is no longer supported since v1.127.0. You can still use this resource to manage the instance which has been already created, but can not create a new one.

Example Usage

Create a Gpdb instance

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = "Gpdb",
        }));
        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
        {
            ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            VswitchName = "vpc-123456",
        });
        var example = new AliCloud.Gpdb.Instance("example", new AliCloud.Gpdb.InstanceArgs
        {
            Description = "tf-gpdb-test",
            Engine = "gpdb",
            EngineVersion = "4.3",
            InstanceClass = "gpdb.group.segsdx2",
            InstanceGroupCount = "2",
            VswitchId = defaultSwitch.Id,
            SecurityIpLists = 
            {
                "10.168.1.12",
                "100.69.7.112",
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/gpdb"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "Gpdb"
		defaultZones, err := alicloud.GetZones(ctx, &GetZonesArgs{
			AvailableResourceCreation: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			ZoneId:      pulumi.String(defaultZones.Zones[0].Id),
			VpcId:       defaultNetwork.ID(),
			CidrBlock:   pulumi.String("172.16.0.0/24"),
			VswitchName: pulumi.String("vpc-123456"),
		})
		if err != nil {
			return err
		}
		_, err = gpdb.NewInstance(ctx, "example", &gpdb.InstanceArgs{
			Description:        pulumi.String("tf-gpdb-test"),
			Engine:             pulumi.String("gpdb"),
			EngineVersion:      pulumi.String("4.3"),
			InstanceClass:      pulumi.String("gpdb.group.segsdx2"),
			InstanceGroupCount: pulumi.String("2"),
			VswitchId:          defaultSwitch.ID(),
			SecurityIpLists: pulumi.StringArray{
				pulumi.String("10.168.1.12"),
				pulumi.String("100.69.7.112"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_alicloud as alicloud

default_zones = alicloud.get_zones(available_resource_creation="Gpdb")
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    zone_id=default_zones.zones[0].id,
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    vswitch_name="vpc-123456")
example = alicloud.gpdb.Instance("example",
    description="tf-gpdb-test",
    engine="gpdb",
    engine_version="4.3",
    instance_class="gpdb.group.segsdx2",
    instance_group_count="2",
    vswitch_id=default_switch.id,
    security_ip_lists=[
        "10.168.1.12",
        "100.69.7.112",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultZones = alicloud.getZones({
    availableResourceCreation: "Gpdb",
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/16"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    vswitchName: "vpc-123456",
});
const example = new alicloud.gpdb.Instance("example", {
    description: "tf-gpdb-test",
    engine: "gpdb",
    engineVersion: "4.3",
    instanceClass: "gpdb.group.segsdx2",
    instanceGroupCount: "2",
    vswitchId: defaultSwitch.id,
    securityIpLists: [
        "10.168.1.12",
        "100.69.7.112",
    ],
});

Create a Instance Resource

new Instance(name: string, args: InstanceArgs, opts?: CustomResourceOptions);
@overload
def Instance(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             availability_zone: Optional[str] = None,
             description: Optional[str] = None,
             engine: Optional[str] = None,
             engine_version: Optional[str] = None,
             instance_charge_type: Optional[str] = None,
             instance_class: Optional[str] = None,
             instance_group_count: Optional[str] = None,
             security_ip_lists: Optional[Sequence[str]] = None,
             tags: Optional[Mapping[str, Any]] = None,
             vswitch_id: Optional[str] = None)
@overload
def Instance(resource_name: str,
             args: InstanceArgs,
             opts: Optional[ResourceOptions] = None)
func NewInstance(ctx *Context, name string, args InstanceArgs, opts ...ResourceOption) (*Instance, error)
public Instance(string name, InstanceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args InstanceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args InstanceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args InstanceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args InstanceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Instance Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Instance resource accepts the following input properties:

InstanceClass string
Instance specification. see Instance specifications.
InstanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
AvailabilityZone string
Description string
The name of DB instance. It a string of 2 to 256 characters.
Engine string
Database engine: gpdb. System Default value: gpdb.
EngineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
InstanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
SecurityIpLists List<string>
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]).
Tags Dictionary<string, object>
A mapping of tags to assign to the resource.
VswitchId string
The virtual switch ID to launch DB instances in one VPC.
InstanceClass string
Instance specification. see Instance specifications.
InstanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
AvailabilityZone string
Description string
The name of DB instance. It a string of 2 to 256 characters.
Engine string
Database engine: gpdb. System Default value: gpdb.
EngineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
InstanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
SecurityIpLists []string
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]).
Tags map[string]interface{}
A mapping of tags to assign to the resource.
VswitchId string
The virtual switch ID to launch DB instances in one VPC.
instanceClass string
Instance specification. see Instance specifications.
instanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
availabilityZone string
description string
The name of DB instance. It a string of 2 to 256 characters.
engine string
Database engine: gpdb. System Default value: gpdb.
engineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
instanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
securityIpLists string[]
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]).
tags {[key: string]: any}
A mapping of tags to assign to the resource.
vswitchId string
The virtual switch ID to launch DB instances in one VPC.
instance_class str
Instance specification. see Instance specifications.
instance_group_count str
The number of groups. Valid values: [2,4,8,16,32]
availability_zone str
description str
The name of DB instance. It a string of 2 to 256 characters.
engine str
Database engine: gpdb. System Default value: gpdb.
engine_version str
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
instance_charge_type str
Valid values are PrePaid, PostPaid,System default to PostPaid.
security_ip_lists Sequence[str]
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]).
tags Mapping[str, Any]
A mapping of tags to assign to the resource.
vswitch_id str
The virtual switch ID to launch DB instances in one VPC.

Outputs

All input properties are implicitly available as output properties. Additionally, the Instance resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Instance Resource

Get an existing Instance resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: InstanceState, opts?: CustomResourceOptions): Instance
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        availability_zone: Optional[str] = None,
        description: Optional[str] = None,
        engine: Optional[str] = None,
        engine_version: Optional[str] = None,
        instance_charge_type: Optional[str] = None,
        instance_class: Optional[str] = None,
        instance_group_count: Optional[str] = None,
        security_ip_lists: Optional[Sequence[str]] = None,
        tags: Optional[Mapping[str, Any]] = None,
        vswitch_id: Optional[str] = None) -> Instance
func GetInstance(ctx *Context, name string, id IDInput, state *InstanceState, opts ...ResourceOption) (*Instance, error)
public static Instance Get(string name, Input<string> id, InstanceState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AvailabilityZone string
Description string
The name of DB instance. It a string of 2 to 256 characters.
Engine string
Database engine: gpdb. System Default value: gpdb.
EngineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
InstanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
InstanceClass string
Instance specification. see Instance specifications.
InstanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
SecurityIpLists List<string>
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]).
Tags Dictionary<string, object>
A mapping of tags to assign to the resource.
VswitchId string
The virtual switch ID to launch DB instances in one VPC.
AvailabilityZone string
Description string
The name of DB instance. It a string of 2 to 256 characters.
Engine string
Database engine: gpdb. System Default value: gpdb.
EngineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
InstanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
InstanceClass string
Instance specification. see Instance specifications.
InstanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
SecurityIpLists []string
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]).
Tags map[string]interface{}
A mapping of tags to assign to the resource.
VswitchId string
The virtual switch ID to launch DB instances in one VPC.
availabilityZone string
description string
The name of DB instance. It a string of 2 to 256 characters.
engine string
Database engine: gpdb. System Default value: gpdb.
engineVersion string
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
instanceChargeType string
Valid values are PrePaid, PostPaid,System default to PostPaid.
instanceClass string
Instance specification. see Instance specifications.
instanceGroupCount string
The number of groups. Valid values: [2,4,8,16,32]
securityIpLists string[]
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]).
tags {[key: string]: any}
A mapping of tags to assign to the resource.
vswitchId string
The virtual switch ID to launch DB instances in one VPC.
availability_zone str
description str
The name of DB instance. It a string of 2 to 256 characters.
engine str
Database engine: gpdb. System Default value: gpdb.
engine_version str
Database version. Value options can refer to the latest docs CreateDBInstance EngineVersion.
instance_charge_type str
Valid values are PrePaid, PostPaid,System default to PostPaid.
instance_class str
Instance specification. see Instance specifications.
instance_group_count str
The number of groups. Valid values: [2,4,8,16,32]
security_ip_lists Sequence[str]
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]).
tags Mapping[str, Any]
A mapping of tags to assign to the resource.
vswitch_id str
The virtual switch ID to launch DB instances in one VPC.

Import

AnalyticDB for PostgreSQL can be imported using the id, e.g.

 $ pulumi import alicloud:gpdb/instance:Instance example gp-bp1291daeda44194

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.