Database class
Provides an Athena database.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3.Bucket("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.Bucket("example", bucket="example")
example_database = aws.athena.Database("example",
name="database_name",
bucket=example.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3.Bucket("example", new()
{
BucketName = "example",
});
var exampleDatabase = new Aws.Athena.Database("example", new()
{
Name = "database_name",
Bucket = example.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/athena"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := s3.NewBucket(ctx, "example", &s3.BucketArgs{
Bucket: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = athena.NewDatabase(ctx, "example", &athena.DatabaseArgs{
Name: pulumi.String("database_name"),
Bucket: example.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_s3_bucket" "example" {
bucket = "example"
}
resource "aws_athena_database" "example" {
name = "database_name"
bucket = aws_s3_bucket.example.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.s3.BucketArgs;
import com.pulumi.aws.athena.Database;
import com.pulumi.aws.athena.DatabaseArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 Bucket("example", BucketArgs.builder()
.bucket("example")
.build());
var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.name("database_name")
.bucket(example.id())
.build());
}
}
resources:
example:
type: aws:s3:Bucket
properties:
bucket: example
exampleDatabase:
type: aws:athena:Database
name: example
properties:
name: database_name
bucket: ${example.id}
Import
Using pulumi import, import Athena Databases using their name. For example:
$ pulumi import aws:athena/database:Database example example
Certain resource arguments, like encryptionConfiguration 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 ignoreChanges to hide the difference. For example:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.athena.Database("example", {
name: "database_name",
bucket: exampleAwsS3Bucket.id,
}, {
ignoreChanges: ["bucket"],
});
import pulumi
import pulumi_aws as aws
example = aws.athena.Database("example",
name="database_name",
bucket=example_aws_s3_bucket["id"],
opts = pulumi.ResourceOptions(ignore_changes=["bucket"]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Athena.Database("example", new()
{
Name = "database_name",
Bucket = exampleAwsS3Bucket.Id,
}, new CustomResourceOptions
{
IgnoreChanges =
{
"bucket",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/athena"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := athena.NewDatabase(ctx, "example", &athena.DatabaseArgs{
Name: pulumi.String("database_name"),
Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
}, pulumi.IgnoreChanges([]string{
"bucket",
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_athena_database" "example" {
lifecycle {
ignore_changes = [bucket]
}
name = "database_name"
bucket = exampleAwsS3Bucket.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.athena.Database;
import com.pulumi.aws.athena.DatabaseArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 Database("example", DatabaseArgs.builder()
.name("database_name")
.bucket(exampleAwsS3Bucket.id())
.build(), CustomResourceOptions.builder()
.ignoreChanges("bucket")
.build());
}
}
resources:
example:
type: aws:athena:Database
properties:
name: database_name
bucket: ${exampleAwsS3Bucket.id}
options:
ignoreChanges:
- bucket
Constructors
- Database(String name, {DatabaseArgs? args, CustomResourceOptions? options})
-
Creates a new Database.
nameThe Pulumi resource name.argsArguments used to configure this Database. The set of arguments for Database.optionsResource options controlling this resource's behavior. - Database.reference(String urn)
- Creates a typed reference to an existing Database resource.
Properties
-
aclConfiguration
↔ Output<
DatabaseAclConfiguration?> -
That an Amazon S3 canned ACL should be set to control ownership of stored query results. See ACL Configuration below.
latefinal
-
bucket
↔ Output<
String?> -
Name of S3 bucket to save the results of the query execution.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
comment
↔ Output<
String?> -
Description of the database.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
encryptionConfiguration
↔ Output<
DatabaseEncryptionConfiguration?> -
Encryption key block AWS Athena uses to decrypt the data in S3, such as a KMS key. See Encryption Configuration below.
latefinal
-
expectedBucketOwner
↔ Output<
String?> -
AWS account ID that you expect to be the owner of the Amazon S3 bucket.
latefinal
-
forceDestroy
↔ Output<
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.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
Name of the database to create.
latefinal
-
properties
↔ Output<
Map< String, String> ?> -
Key-value map of custom metadata properties for the database definition.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
workgroup
↔ Output<
String?> -
Name of the workgroup.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited