1. Packages
  2. Aptible Provider
  3. API Docs
  4. Database
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

aptible.Database

Explore with Pulumi AI

aptible logo
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

    # Aptible Database Resource

    This resource is used to create and manage Databases running on Aptible Deploy.

    !> Changing the handle of a database will destroy the existing database and create a new one, resulting in a database without data. The old database can still be recovered by restoring a backup as long as your retention policy supports final backups.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aptible from "@pulumi/aptible";
    
    const exampleDatabase = new aptible.Database("exampleDatabase", {
        containerSize: 512,
        databaseType: "redis",
        diskSize: 10,
        envId: 123,
        handle: "example_database",
        version: "",
    });
    
    import pulumi
    import pulumi_aptible as aptible
    
    example_database = aptible.Database("exampleDatabase",
        container_size=512,
        database_type="redis",
        disk_size=10,
        env_id=123,
        handle="example_database",
        version="")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/aptible/aptible"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aptible.NewDatabase(ctx, "exampleDatabase", &aptible.DatabaseArgs{
    			ContainerSize: pulumi.Float64(512),
    			DatabaseType:  pulumi.String("redis"),
    			DiskSize:      pulumi.Float64(10),
    			EnvId:         pulumi.Float64(123),
    			Handle:        pulumi.String("example_database"),
    			Version:       pulumi.String(""),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aptible = Pulumi.Aptible;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleDatabase = new Aptible.Database("exampleDatabase", new()
        {
            ContainerSize = 512,
            DatabaseType = "redis",
            DiskSize = 10,
            EnvId = 123,
            Handle = "example_database",
            Version = "",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aptible.Database;
    import com.pulumi.aptible.DatabaseArgs;
    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) {
            var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
                .containerSize(512)
                .databaseType("redis")
                .diskSize(10)
                .envId(123)
                .handle("example_database")
                .version("")
                .build());
    
        }
    }
    
    resources:
      exampleDatabase:
        type: aptible:Database
        properties:
          containerSize: 512
          databaseType: redis
          diskSize: 10
          envId: 123
          handle: example_database
          version: ""
    

    Create Database Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def Database(resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 env_id: Optional[float] = None,
                 handle: Optional[str] = None,
                 aptible_database_id: Optional[str] = None,
                 container_profile: Optional[str] = None,
                 container_size: Optional[float] = None,
                 database_type: Optional[str] = None,
                 disk_size: Optional[float] = None,
                 enable_backups: Optional[bool] = None,
                 iops: Optional[float] = None,
                 version: Optional[str] = None)
    func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
    public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
    public Database(String name, DatabaseArgs args)
    public Database(String name, DatabaseArgs args, CustomResourceOptions options)
    
    type: aptible:Database
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DatabaseArgs
    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 DatabaseArgs
    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 DatabaseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DatabaseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DatabaseArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var databaseResource = new Aptible.Database("databaseResource", new()
    {
        EnvId = 0,
        Handle = "string",
        AptibleDatabaseId = "string",
        ContainerProfile = "string",
        ContainerSize = 0,
        DatabaseType = "string",
        DiskSize = 0,
        EnableBackups = false,
        Iops = 0,
        Version = "string",
    });
    
    example, err := aptible.NewDatabase(ctx, "databaseResource", &aptible.DatabaseArgs{
    	EnvId:             pulumi.Float64(0),
    	Handle:            pulumi.String("string"),
    	AptibleDatabaseId: pulumi.String("string"),
    	ContainerProfile:  pulumi.String("string"),
    	ContainerSize:     pulumi.Float64(0),
    	DatabaseType:      pulumi.String("string"),
    	DiskSize:          pulumi.Float64(0),
    	EnableBackups:     pulumi.Bool(false),
    	Iops:              pulumi.Float64(0),
    	Version:           pulumi.String("string"),
    })
    
    var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
        .envId(0)
        .handle("string")
        .aptibleDatabaseId("string")
        .containerProfile("string")
        .containerSize(0)
        .databaseType("string")
        .diskSize(0)
        .enableBackups(false)
        .iops(0)
        .version("string")
        .build());
    
    database_resource = aptible.Database("databaseResource",
        env_id=0,
        handle="string",
        aptible_database_id="string",
        container_profile="string",
        container_size=0,
        database_type="string",
        disk_size=0,
        enable_backups=False,
        iops=0,
        version="string")
    
    const databaseResource = new aptible.Database("databaseResource", {
        envId: 0,
        handle: "string",
        aptibleDatabaseId: "string",
        containerProfile: "string",
        containerSize: 0,
        databaseType: "string",
        diskSize: 0,
        enableBackups: false,
        iops: 0,
        version: "string",
    });
    
    type: aptible:Database
    properties:
        aptibleDatabaseId: string
        containerProfile: string
        containerSize: 0
        databaseType: string
        diskSize: 0
        enableBackups: false
        envId: 0
        handle: string
        iops: 0
        version: string
    

    Database Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Database resource accepts the following input properties:

    EnvId double
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    AptibleDatabaseId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize double
    The size of container used for the Database, in MB of RAM.
    DatabaseType string
    The type of Database.
    DiskSize double
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    Iops double
    The disk Input/Output Operations Per Second
    Version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    EnvId float64
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    AptibleDatabaseId string
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize float64
    The size of container used for the Database, in MB of RAM.
    DatabaseType string
    The type of Database.
    DiskSize float64
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    Iops float64
    The disk Input/Output Operations Per Second
    Version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    envId Double
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    aptibleDatabaseId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Double
    The size of container used for the Database, in MB of RAM.
    databaseType String
    The type of Database.
    diskSize Double
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    iops Double
    The disk Input/Output Operations Per Second
    version String
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    envId number
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    aptibleDatabaseId string
    containerProfile string
    Changes the CPU:RAM ratio of the Database container.
    containerSize number
    The size of container used for the Database, in MB of RAM.
    databaseType string
    The type of Database.
    diskSize number
    The disk size of the Database, in GB.
    enableBackups boolean
    Whether to automatically backup the database according to the retention policy.
    iops number
    The disk Input/Output Operations Per Second
    version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    env_id float
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle str
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    aptible_database_id str
    container_profile str
    Changes the CPU:RAM ratio of the Database container.
    container_size float
    The size of container used for the Database, in MB of RAM.
    database_type str
    The type of Database.
    disk_size float
    The disk size of the Database, in GB.
    enable_backups bool
    Whether to automatically backup the database according to the retention policy.
    iops float
    The disk Input/Output Operations Per Second
    version str
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    envId Number
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    aptibleDatabaseId String
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Number
    The size of container used for the Database, in MB of RAM.
    databaseType String
    The type of Database.
    diskSize Number
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    iops Number
    The disk Input/Output Operations Per Second
    version String
    The version of the Database. If none is specified, this defaults to the latest recommended version.

    Outputs

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

    ConnectionUrls List<string>
    A list of all available database credentials in connection URL format
    DatabaseId double
    The unique ID for the database
    DatabaseImageId double
    The image used for running the database. Normally only used for support or debugging purposes
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    Id string
    The provider-assigned unique ID for this managed resource.
    ConnectionUrls []string
    A list of all available database credentials in connection URL format
    DatabaseId float64
    The unique ID for the database
    DatabaseImageId float64
    The image used for running the database. Normally only used for support or debugging purposes
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    Id string
    The provider-assigned unique ID for this managed resource.
    connectionUrls List<String>
    A list of all available database credentials in connection URL format
    databaseId Double
    The unique ID for the database
    databaseImageId Double
    The image used for running the database. Normally only used for support or debugging purposes
    defaultConnectionUrl String
    The default database credentials in connection URL format
    id String
    The provider-assigned unique ID for this managed resource.
    connectionUrls string[]
    A list of all available database credentials in connection URL format
    databaseId number
    The unique ID for the database
    databaseImageId number
    The image used for running the database. Normally only used for support or debugging purposes
    defaultConnectionUrl string
    The default database credentials in connection URL format
    id string
    The provider-assigned unique ID for this managed resource.
    connection_urls Sequence[str]
    A list of all available database credentials in connection URL format
    database_id float
    The unique ID for the database
    database_image_id float
    The image used for running the database. Normally only used for support or debugging purposes
    default_connection_url str
    The default database credentials in connection URL format
    id str
    The provider-assigned unique ID for this managed resource.
    connectionUrls List<String>
    A list of all available database credentials in connection URL format
    databaseId Number
    The unique ID for the database
    databaseImageId Number
    The image used for running the database. Normally only used for support or debugging purposes
    defaultConnectionUrl String
    The default database credentials in connection URL format
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Database Resource

    Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            aptible_database_id: Optional[str] = None,
            connection_urls: Optional[Sequence[str]] = None,
            container_profile: Optional[str] = None,
            container_size: Optional[float] = None,
            database_id: Optional[float] = None,
            database_image_id: Optional[float] = None,
            database_type: Optional[str] = None,
            default_connection_url: Optional[str] = None,
            disk_size: Optional[float] = None,
            enable_backups: Optional[bool] = None,
            env_id: Optional[float] = None,
            handle: Optional[str] = None,
            iops: Optional[float] = None,
            version: Optional[str] = None) -> Database
    func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
    public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
    public static Database get(String name, Output<String> id, DatabaseState state, CustomResourceOptions options)
    resources:  _:    type: aptible:Database    get:      id: ${id}
    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.
    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:
    AptibleDatabaseId string
    ConnectionUrls List<string>
    A list of all available database credentials in connection URL format
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize double
    The size of container used for the Database, in MB of RAM.
    DatabaseId double
    The unique ID for the database
    DatabaseImageId double
    The image used for running the database. Normally only used for support or debugging purposes
    DatabaseType string
    The type of Database.
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    DiskSize double
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    EnvId double
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    Iops double
    The disk Input/Output Operations Per Second
    Version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    AptibleDatabaseId string
    ConnectionUrls []string
    A list of all available database credentials in connection URL format
    ContainerProfile string
    Changes the CPU:RAM ratio of the Database container.
    ContainerSize float64
    The size of container used for the Database, in MB of RAM.
    DatabaseId float64
    The unique ID for the database
    DatabaseImageId float64
    The image used for running the database. Normally only used for support or debugging purposes
    DatabaseType string
    The type of Database.
    DefaultConnectionUrl string
    The default database credentials in connection URL format
    DiskSize float64
    The disk size of the Database, in GB.
    EnableBackups bool
    Whether to automatically backup the database according to the retention policy.
    EnvId float64
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    Handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    Iops float64
    The disk Input/Output Operations Per Second
    Version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    aptibleDatabaseId String
    connectionUrls List<String>
    A list of all available database credentials in connection URL format
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Double
    The size of container used for the Database, in MB of RAM.
    databaseId Double
    The unique ID for the database
    databaseImageId Double
    The image used for running the database. Normally only used for support or debugging purposes
    databaseType String
    The type of Database.
    defaultConnectionUrl String
    The default database credentials in connection URL format
    diskSize Double
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    envId Double
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops Double
    The disk Input/Output Operations Per Second
    version String
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    aptibleDatabaseId string
    connectionUrls string[]
    A list of all available database credentials in connection URL format
    containerProfile string
    Changes the CPU:RAM ratio of the Database container.
    containerSize number
    The size of container used for the Database, in MB of RAM.
    databaseId number
    The unique ID for the database
    databaseImageId number
    The image used for running the database. Normally only used for support or debugging purposes
    databaseType string
    The type of Database.
    defaultConnectionUrl string
    The default database credentials in connection URL format
    diskSize number
    The disk size of the Database, in GB.
    enableBackups boolean
    Whether to automatically backup the database according to the retention policy.
    envId number
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle string
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops number
    The disk Input/Output Operations Per Second
    version string
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    aptible_database_id str
    connection_urls Sequence[str]
    A list of all available database credentials in connection URL format
    container_profile str
    Changes the CPU:RAM ratio of the Database container.
    container_size float
    The size of container used for the Database, in MB of RAM.
    database_id float
    The unique ID for the database
    database_image_id float
    The image used for running the database. Normally only used for support or debugging purposes
    database_type str
    The type of Database.
    default_connection_url str
    The default database credentials in connection URL format
    disk_size float
    The disk size of the Database, in GB.
    enable_backups bool
    Whether to automatically backup the database according to the retention policy.
    env_id float
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle str
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops float
    The disk Input/Output Operations Per Second
    version str
    The version of the Database. If none is specified, this defaults to the latest recommended version.
    aptibleDatabaseId String
    connectionUrls List<String>
    A list of all available database credentials in connection URL format
    containerProfile String
    Changes the CPU:RAM ratio of the Database container.
    containerSize Number
    The size of container used for the Database, in MB of RAM.
    databaseId Number
    The unique ID for the database
    databaseImageId Number
    The image used for running the database. Normally only used for support or debugging purposes
    databaseType String
    The type of Database.
    defaultConnectionUrl String
    The default database credentials in connection URL format
    diskSize Number
    The disk size of the Database, in GB.
    enableBackups Boolean
    Whether to automatically backup the database according to the retention policy.
    envId Number
    The ID of the environment you would like to deploy your Database in. See main provider documentation for more on how to determine what you should use for env_id.
    handle String
    The handle for the Database. This must be all lower case, and only contain letters, numbers, -, _, or .
    iops Number
    The disk Input/Output Operations Per Second
    version String
    The version of the Database. If none is specified, this defaults to the latest recommended version.

    Import

    Existing Databases can be imported using the Database ID. For example:

    bash

    $ pulumi import aptible:index/database:Database example-database <ID>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    aptible aptible/terraform-provider-aptible
    License
    Notes
    This Pulumi package is based on the aptible Terraform Provider.
    aptible logo
    aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible