Bootstrap FreeKB - Amazon Web Services (AWS) - Create Database in AWS Athena
Amazon Web Services (AWS) - Create Database in AWS Athena


AWS Athena can be used to

  • query lines in files in an S3 Bucket
  • query SQL databases

For example, let's say you have a file named foo.txt in one of your S3 Buckets.

 

And let's say foo.txt contains the following lines.

1	hello
2	world

 

Let's start by creating a different S3 Bucket that will be used to store the AWS Athena stuff. The aws s3api create-bucket command can be used to create an S3 Bucket.

aws s3api create-bucket --bucket my-athena-bucket-abc123 --region us-east-1

 

Over in the AWS Athena console, if this is your first time using Athena, select Edit settings.

 

And let's select the S3 Bucket you just created.

 

The aws s3api list-objects command can be used to list the objects in the S3 Bucket. At this point, there should be no objects in the S3 Bucket.

~]$ aws s3api list-objects --bucket my-athena-bucket-abc123
{
    "Contents": []
}

 

In the Athena Editor, let's go with query CREATE DATABASE mydatabase and select Run. The result should be Query successful

 

There should now be a 0 byte TXT file in your Athena S3 Bucket.

 

And the database you just created should be listed in the left panel of the Athena console.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 77d9b8 in the box below so that we can be sure you are a human.