1. Packages
  2. AWS
  3. API Docs
  4. athena
  5. Database
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.athena.Database

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides an Athena database.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketV2("example", {bucket: "example"});
    const exampleDatabase = new aws.athena.Database("example", {
        name: "database_name",
        bucket: example.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketV2("example", bucket="example")
    example_database = aws.athena.Database("example",
        name="database_name",
        bucket=example.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    			Bucket: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = athena.NewDatabase(ctx, "example", &athena.DatabaseArgs{
    			Name:   pulumi.String("database_name"),
    			Bucket: example.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.S3.BucketV2("example", new()
        {
            Bucket = "example",
        });
    
        var exampleDatabase = new Aws.Athena.Database("example", new()
        {
            Name = "database_name",
            Bucket = example.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.s3.BucketV2Args;
    import com.pulumi.aws.athena.Database;
    import com.pulumi.aws.athena.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 example = new BucketV2("example", BucketV2Args.builder()
                .bucket("example")
                .build());
    
            var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
                .name("database_name")
                .bucket(example.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketV2
        properties:
          bucket: example
      exampleDatabase:
        type: aws:athena:Database
        name: example
        properties:
          name: database_name
          bucket: ${example.id}
    

    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: Optional[DatabaseArgs] = None,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 acl_configuration: Optional[DatabaseAclConfigurationArgs] = None,
                 bucket: Optional[str] = None,
                 comment: Optional[str] = None,
                 encryption_configuration: Optional[DatabaseEncryptionConfigurationArgs] = None,
                 expected_bucket_owner: Optional[str] = None,
                 force_destroy: Optional[bool] = None,
                 name: Optional[str] = None,
                 properties: Optional[Mapping[str, str]] = None)
    func NewDatabase(ctx *Context, name string, args *DatabaseArgs, opts ...ResourceOption) (*Database, error)
    public Database(string name, DatabaseArgs? args = null, CustomResourceOptions? opts = null)
    public Database(String name, DatabaseArgs args)
    public Database(String name, DatabaseArgs args, CustomResourceOptions options)
    
    type: aws:athena: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 Aws.Athena.Database("databaseResource", new()
    {
        AclConfiguration = new Aws.Athena.Inputs.DatabaseAclConfigurationArgs
        {
            S3AclOption = "string",
        },
        Bucket = "string",
        Comment = "string",
        EncryptionConfiguration = new Aws.Athena.Inputs.DatabaseEncryptionConfigurationArgs
        {
            EncryptionOption = "string",
            KmsKey = "string",
        },
        ExpectedBucketOwner = "string",
        ForceDestroy = false,
        Name = "string",
        Properties = 
        {
            { "string", "string" },
        },
    });
    
    example, err := athena.NewDatabase(ctx, "databaseResource", &athena.DatabaseArgs{
    	AclConfiguration: &athena.DatabaseAclConfigurationArgs{
    		S3AclOption: pulumi.String("string"),
    	},
    	Bucket:  pulumi.String("string"),
    	Comment: pulumi.String("string"),
    	EncryptionConfiguration: &athena.DatabaseEncryptionConfigurationArgs{
    		EncryptionOption: pulumi.String("string"),
    		KmsKey:           pulumi.String("string"),
    	},
    	ExpectedBucketOwner: pulumi.String("string"),
    	ForceDestroy:        pulumi.Bool(false),
    	Name:                pulumi.String("string"),
    	Properties: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
        .aclConfiguration(DatabaseAclConfigurationArgs.builder()
            .s3AclOption("string")
            .build())
        .bucket("string")
        .comment("string")
        .encryptionConfiguration(DatabaseEncryptionConfigurationArgs.builder()
            .encryptionOption("string")
            .kmsKey("string")
            .build())
        .expectedBucketOwner("string")
        .forceDestroy(false)
        .name("string")
        .properties(Map.of("string", "string"))
        .build());
    
    database_resource = aws.athena.Database("databaseResource",
        acl_configuration={
            "s3_acl_option": "string",
        },
        bucket="string",
        comment="string",
        encryption_configuration={
            "encryption_option": "string",
            "kms_key": "string",
        },
        expected_bucket_owner="string",
        force_destroy=False,
        name="string",
        properties={
            "string": "string",
        })
    
    const databaseResource = new aws.athena.Database("databaseResource", {
        aclConfiguration: {
            s3AclOption: "string",
        },
        bucket: "string",
        comment: "string",
        encryptionConfiguration: {
            encryptionOption: "string",
            kmsKey: "string",
        },
        expectedBucketOwner: "string",
        forceDestroy: false,
        name: "string",
        properties: {
            string: "string",
        },
    });
    
    type: aws:athena:Database
    properties:
        aclConfiguration:
            s3AclOption: string
        bucket: string
        comment: string
        encryptionConfiguration:
            encryptionOption: string
            kmsKey: string
        expectedBucketOwner: string
        forceDestroy: false
        name: string
        properties:
            string: 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:

    AclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    Bucket string
    Name of S3 bucket to save the results of the query execution.
    Comment string
    Description of the database.
    EncryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    ExpectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    ForceDestroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    Name string
    Name of the database to create.
    Properties Dictionary<string, string>
    Key-value map of custom metadata properties for the database definition.
    AclConfiguration DatabaseAclConfigurationArgs
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    Bucket string
    Name of S3 bucket to save the results of the query execution.
    Comment string
    Description of the database.
    EncryptionConfiguration DatabaseEncryptionConfigurationArgs
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    ExpectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    ForceDestroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    Name string
    Name of the database to create.
    Properties map[string]string
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket String
    Name of S3 bucket to save the results of the query execution.
    comment String
    Description of the database.
    encryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner String
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy Boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name String
    Name of the database to create.
    properties Map<String,String>
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket string
    Name of S3 bucket to save the results of the query execution.
    comment string
    Description of the database.
    encryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name string
    Name of the database to create.
    properties {[key: string]: string}
    Key-value map of custom metadata properties for the database definition.
    acl_configuration DatabaseAclConfigurationArgs
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket str
    Name of S3 bucket to save the results of the query execution.
    comment str
    Description of the database.
    encryption_configuration DatabaseEncryptionConfigurationArgs
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expected_bucket_owner str
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    force_destroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name str
    Name of the database to create.
    properties Mapping[str, str]
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration Property Map
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket String
    Name of S3 bucket to save the results of the query execution.
    comment String
    Description of the database.
    encryptionConfiguration Property Map
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner String
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy Boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name String
    Name of the database to create.
    properties Map<String>
    Key-value map of custom metadata properties for the database definition.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Database 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 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,
            acl_configuration: Optional[DatabaseAclConfigurationArgs] = None,
            bucket: Optional[str] = None,
            comment: Optional[str] = None,
            encryption_configuration: Optional[DatabaseEncryptionConfigurationArgs] = None,
            expected_bucket_owner: Optional[str] = None,
            force_destroy: Optional[bool] = None,
            name: Optional[str] = None,
            properties: Optional[Mapping[str, 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)
    Resource lookup is not supported in YAML
    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:
    AclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    Bucket string
    Name of S3 bucket to save the results of the query execution.
    Comment string
    Description of the database.
    EncryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    ExpectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    ForceDestroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    Name string
    Name of the database to create.
    Properties Dictionary<string, string>
    Key-value map of custom metadata properties for the database definition.
    AclConfiguration DatabaseAclConfigurationArgs
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    Bucket string
    Name of S3 bucket to save the results of the query execution.
    Comment string
    Description of the database.
    EncryptionConfiguration DatabaseEncryptionConfigurationArgs
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    ExpectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    ForceDestroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    Name string
    Name of the database to create.
    Properties map[string]string
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket String
    Name of S3 bucket to save the results of the query execution.
    comment String
    Description of the database.
    encryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner String
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy Boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name String
    Name of the database to create.
    properties Map<String,String>
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration DatabaseAclConfiguration
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket string
    Name of S3 bucket to save the results of the query execution.
    comment string
    Description of the database.
    encryptionConfiguration DatabaseEncryptionConfiguration
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner string
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name string
    Name of the database to create.
    properties {[key: string]: string}
    Key-value map of custom metadata properties for the database definition.
    acl_configuration DatabaseAclConfigurationArgs
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket str
    Name of S3 bucket to save the results of the query execution.
    comment str
    Description of the database.
    encryption_configuration DatabaseEncryptionConfigurationArgs
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expected_bucket_owner str
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    force_destroy bool
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name str
    Name of the database to create.
    properties Mapping[str, str]
    Key-value map of custom metadata properties for the database definition.
    aclConfiguration Property Map
    That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
    bucket String
    Name of S3 bucket to save the results of the query execution.
    comment String
    Description of the database.
    encryptionConfiguration Property Map
    Encryption key block AWS Athena uses to decrypt the data in S3, such as an AWS Key Management Service (AWS KMS) key. See Encryption Configuration below.
    expectedBucketOwner String
    AWS account ID that you expect to be the owner of the Amazon S3 bucket.
    forceDestroy Boolean
    Boolean that indicates all tables should be deleted from the database so that the database can be destroyed without error. The tables are not recoverable.
    name String
    Name of the database to create.
    properties Map<String>
    Key-value map of custom metadata properties for the database definition.

    Supporting Types

    DatabaseAclConfiguration, DatabaseAclConfigurationArgs

    S3AclOption string

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    S3AclOption string

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    s3AclOption String

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    s3AclOption string

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    s3_acl_option str

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    s3AclOption String

    Amazon S3 canned ACL that Athena should specify when storing query results. Valid value is BUCKET_OWNER_FULL_CONTROL.

    NOTE: When Athena queries are executed, result files may be created in the specified bucket. Consider using force_destroy on the bucket too in order to avoid any problems when destroying the bucket.

    DatabaseEncryptionConfiguration, DatabaseEncryptionConfigurationArgs

    EncryptionOption string
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    KmsKey string
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.
    EncryptionOption string
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    KmsKey string
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.
    encryptionOption String
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    kmsKey String
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.
    encryptionOption string
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    kmsKey string
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.
    encryption_option str
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    kms_key str
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.
    encryptionOption String
    Type of key; one of SSE_S3, SSE_KMS, CSE_KMS
    kmsKey String
    KMS key ARN or ID; required for key types SSE_KMS and CSE_KMS.

    Import

    Using pulumi import, import Athena Databases using their name. For example:

    $ pulumi import aws:athena/database:Database example example
    

    Certain resource arguments, like encryption_configuration and bucket, do not have an API method for reading the information after creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use ignore_changes to hide the difference. For example:

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

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi