Connecting Athena DB to a Glue catalog

34 views
Skip to first unread message

steven...@gmail.com

unread,
Mar 15, 2019, 9:49:24 AM3/15/19
to Terraform
This question has also been asked on StackOverflow, but there's not been much response. Additionally, I only recently discovered this Google Group so I thought I'd ask it here.

To replicate the SO question:

I'm confused as to how I should use Terraform to connect Athena to my Glue Catalog database.

I use 

    resource "aws_glue_catalog_database" "catalog_database" {
        name
= "${var.glue_db_name}"
   
}
   
    resource
"aws_glue_crawler" "datalake_crawler" {
        database_name
= "${var.glue_db_name}"
        name          
= "${var.crawler_name}"
        role          
= "${aws_iam_role.crawler_iam_role.name}"
        description  
= "${var.crawler_description}"
        table_prefix  
= "${var.table_prefix}"
        schedule      
= "${var.schedule}"
   
        s3_target
{
          path
= "s3://${var.data_bucket_name[0]}"
     
}
        s3_target
{  
      path
= "s3://${var.data_bucket_name[1]}"
     
}
     
}


to create a Glue DB and the crawler to crawl an s3 bucket (here only two), but I don't know how I link the Athena query service to the Glue DB. In the terraform documentation for Athena, there doesn't appear to be a way to connect Athena to a Glue cataglog but only to an S3 Bucket. Clearly, however, Athena can be integrated with Glue

How can I terraform an Athena database to use my Glue catalog as it's data source rather than an S3 bucket?
Reply all
Reply to author
Forward
0 new messages