1. Packages
  2. Aiven Provider
  3. API Docs
  4. MysqlDatabase
Aiven v6.48.0 published on Wednesday, Jan 28, 2026 by Pulumi
aiven logo
Aiven v6.48.0 published on Wednesday, Jan 28, 2026 by Pulumi

    Creates and manages an Aiven for MySQL® database. If this resource is missing (e.g., after a service power off), it will be removed from the state and a new create plan will be generated.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const exampleMysqlDatabase = new aiven.MysqlDatabase("example_mysql_database", {
        project: exampleProject.project,
        serviceName: exampleMysql.serviceName,
        databaseName: "example-database",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    example_mysql_database = aiven.MysqlDatabase("example_mysql_database",
        project=example_project["project"],
        service_name=example_mysql["serviceName"],
        database_name="example-database")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aiven.NewMysqlDatabase(ctx, "example_mysql_database", &aiven.MysqlDatabaseArgs{
    			Project:      pulumi.Any(exampleProject.Project),
    			ServiceName:  pulumi.Any(exampleMysql.ServiceName),
    			DatabaseName: pulumi.String("example-database"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleMysqlDatabase = new Aiven.MysqlDatabase("example_mysql_database", new()
        {
            Project = exampleProject.Project,
            ServiceName = exampleMysql.ServiceName,
            DatabaseName = "example-database",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.MysqlDatabase;
    import com.pulumi.aiven.MysqlDatabaseArgs;
    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 exampleMysqlDatabase = new MysqlDatabase("exampleMysqlDatabase", MysqlDatabaseArgs.builder()
                .project(exampleProject.project())
                .serviceName(exampleMysql.serviceName())
                .databaseName("example-database")
                .build());
    
        }
    }
    
    resources:
      exampleMysqlDatabase:
        type: aiven:MysqlDatabase
        name: example_mysql_database
        properties:
          project: ${exampleProject.project}
          serviceName: ${exampleMysql.serviceName}
          databaseName: example-database
    

    Create MysqlDatabase Resource

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

    Constructor syntax

    new MysqlDatabase(name: string, args: MysqlDatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def MysqlDatabase(resource_name: str,
                      args: MysqlDatabaseArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def MysqlDatabase(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      database_name: Optional[str] = None,
                      project: Optional[str] = None,
                      service_name: Optional[str] = None,
                      termination_protection: Optional[bool] = None,
                      timeouts: Optional[MysqlDatabaseTimeoutsArgs] = None)
    func NewMysqlDatabase(ctx *Context, name string, args MysqlDatabaseArgs, opts ...ResourceOption) (*MysqlDatabase, error)
    public MysqlDatabase(string name, MysqlDatabaseArgs args, CustomResourceOptions? opts = null)
    public MysqlDatabase(String name, MysqlDatabaseArgs args)
    public MysqlDatabase(String name, MysqlDatabaseArgs args, CustomResourceOptions options)
    
    type: aiven:MysqlDatabase
    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 MysqlDatabaseArgs
    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 MysqlDatabaseArgs
    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 MysqlDatabaseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MysqlDatabaseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MysqlDatabaseArgs
    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 mysqlDatabaseResource = new Aiven.MysqlDatabase("mysqlDatabaseResource", new()
    {
        DatabaseName = "string",
        Project = "string",
        ServiceName = "string",
        Timeouts = new Aiven.Inputs.MysqlDatabaseTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Read = "string",
            Update = "string",
        },
    });
    
    example, err := aiven.NewMysqlDatabase(ctx, "mysqlDatabaseResource", &aiven.MysqlDatabaseArgs{
    	DatabaseName: pulumi.String("string"),
    	Project:      pulumi.String("string"),
    	ServiceName:  pulumi.String("string"),
    	Timeouts: &aiven.MysqlDatabaseTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Read:   pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var mysqlDatabaseResource = new MysqlDatabase("mysqlDatabaseResource", MysqlDatabaseArgs.builder()
        .databaseName("string")
        .project("string")
        .serviceName("string")
        .timeouts(MysqlDatabaseTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .read("string")
            .update("string")
            .build())
        .build());
    
    mysql_database_resource = aiven.MysqlDatabase("mysqlDatabaseResource",
        database_name="string",
        project="string",
        service_name="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "read": "string",
            "update": "string",
        })
    
    const mysqlDatabaseResource = new aiven.MysqlDatabase("mysqlDatabaseResource", {
        databaseName: "string",
        project: "string",
        serviceName: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            read: "string",
            update: "string",
        },
    });
    
    type: aiven:MysqlDatabase
    properties:
        databaseName: string
        project: string
        serviceName: string
        timeouts:
            create: string
            delete: string
            read: string
            update: string
    

    MysqlDatabase 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 MysqlDatabase resource accepts the following input properties:

    DatabaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    Project string
    Project name. Changing this property forces recreation of the resource.
    ServiceName string
    Service name. Changing this property forces recreation of the resource.
    TerminationProtection bool

    Deprecated: Instead use prevent_destroy

    Timeouts MysqlDatabaseTimeouts
    DatabaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    Project string
    Project name. Changing this property forces recreation of the resource.
    ServiceName string
    Service name. Changing this property forces recreation of the resource.
    TerminationProtection bool

    Deprecated: Instead use prevent_destroy

    Timeouts MysqlDatabaseTimeoutsArgs
    databaseName String
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project String
    Project name. Changing this property forces recreation of the resource.
    serviceName String
    Service name. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeouts
    databaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project string
    Project name. Changing this property forces recreation of the resource.
    serviceName string
    Service name. Changing this property forces recreation of the resource.
    terminationProtection boolean

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeouts
    database_name str
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project str
    Project name. Changing this property forces recreation of the resource.
    service_name str
    Service name. Changing this property forces recreation of the resource.
    termination_protection bool

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeoutsArgs
    databaseName String
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project String
    Project name. Changing this property forces recreation of the resource.
    serviceName String
    Service name. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    Deprecated: Instead use prevent_destroy

    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the MysqlDatabase 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing MysqlDatabase Resource

    Get an existing MysqlDatabase 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?: MysqlDatabaseState, opts?: CustomResourceOptions): MysqlDatabase
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            database_name: Optional[str] = None,
            project: Optional[str] = None,
            service_name: Optional[str] = None,
            termination_protection: Optional[bool] = None,
            timeouts: Optional[MysqlDatabaseTimeoutsArgs] = None) -> MysqlDatabase
    func GetMysqlDatabase(ctx *Context, name string, id IDInput, state *MysqlDatabaseState, opts ...ResourceOption) (*MysqlDatabase, error)
    public static MysqlDatabase Get(string name, Input<string> id, MysqlDatabaseState? state, CustomResourceOptions? opts = null)
    public static MysqlDatabase get(String name, Output<String> id, MysqlDatabaseState state, CustomResourceOptions options)
    resources:  _:    type: aiven:MysqlDatabase    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:
    DatabaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    Project string
    Project name. Changing this property forces recreation of the resource.
    ServiceName string
    Service name. Changing this property forces recreation of the resource.
    TerminationProtection bool

    Deprecated: Instead use prevent_destroy

    Timeouts MysqlDatabaseTimeouts
    DatabaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    Project string
    Project name. Changing this property forces recreation of the resource.
    ServiceName string
    Service name. Changing this property forces recreation of the resource.
    TerminationProtection bool

    Deprecated: Instead use prevent_destroy

    Timeouts MysqlDatabaseTimeoutsArgs
    databaseName String
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project String
    Project name. Changing this property forces recreation of the resource.
    serviceName String
    Service name. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeouts
    databaseName string
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project string
    Project name. Changing this property forces recreation of the resource.
    serviceName string
    Service name. Changing this property forces recreation of the resource.
    terminationProtection boolean

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeouts
    database_name str
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project str
    Project name. Changing this property forces recreation of the resource.
    service_name str
    Service name. Changing this property forces recreation of the resource.
    termination_protection bool

    Deprecated: Instead use prevent_destroy

    timeouts MysqlDatabaseTimeoutsArgs
    databaseName String
    Service database name. Maximum length: 40. Changing this property forces recreation of the resource.
    project String
    Project name. Changing this property forces recreation of the resource.
    serviceName String
    Service name. Changing this property forces recreation of the resource.
    terminationProtection Boolean

    Deprecated: Instead use prevent_destroy

    timeouts Property Map

    Supporting Types

    MysqlDatabaseTimeouts, MysqlDatabaseTimeoutsArgs

    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Default string
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Read string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Default string
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Read string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    default_ String
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    read String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    default string
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    read string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    default str
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    delete str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    read str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    update str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    default String
    Timeout for all operations. Deprecated, use operation-specific timeouts instead.

    Deprecated: Use operation-specific timeouts instead. This field will be removed in the next major version.

    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    read String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

    Import

    $ pulumi import aiven:index/mysqlDatabase:MysqlDatabase example PROJECT/SERVICE_NAME/DATABASE_NAME
    

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

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.48.0 published on Wednesday, Jan 28, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate