Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we create database and table in Amazon Athena using CloudFormation

Is there any way to create DataBase and Table in Amazon Athena using CloudFormation. I referred to AWS documentation and there seems to be only one resource which can be created using CloudFormation.

Ref :

  • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html

  • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html

like image 476
Suresh Kumar Avatar asked Feb 06 '18 11:02

Suresh Kumar


People also ask

How do I create a table from a CSV file in Athena?

Use a CREATE TABLE statement to create an Athena table based on the data. Reference the OpenCSVSerDe class after ROW FORMAT SERDE and specify the character separator, quote character, and escape character in WITH SERDEPROPERTIES , as in the following example.


2 Answers

It is now possible to create Athena Table in CloudFormation through the Glue Data Catalog: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-table.html

like image 50
ics88 Avatar answered Nov 09 '22 12:11

ics88


I think its possible with (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Athena.html) AWS::Athena::WorkGroup & AWS::Athena::NamedQuery

**NamesQuery - where you will provide your SQL/DDL to create the table.

Example from AWS


https://athena-in-action.workshop.aws/20-howtostart/201-self-paced/2013-cloudformation.html

like image 34
Tushar De Avatar answered Nov 09 '22 11:11

Tushar De