Creating databases in Athena - Amazon Athena
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Creating databases in Athena

A database in Athena is a logical grouping for tables you create in it.


If you do not already have a query output location set up in Amazon S3, perform the following prerequisite steps to do so.

To create a query output location
  1. Using the same Amazon Web Services Region and account that you are using for Athena, follow the steps (for example, by using the Amazon S3 console) to create a bucket in Amazon S3 to hold your Athena query results. You will configure this bucket to be your query output location.

  2. Open the Athena console at

  3. If this is your first time to visit the Athena console in this Amazon Web Services Region, choose Explore the query editor to open the query editor. Otherwise, Athena opens in the query editor.

  4. Choose Edit Settings to set up a query result location in Amazon S3.

    Choose Edit settings.
  5. For Manage settings, do one of the following:

    • In the Location of query result box, enter the path to the bucket that you created in Amazon S3 for your query results. Prefix the path with s3://.

    • Choose Browse S3, choose the Amazon S3 bucket that you created for your current Region, and then choose Choose.

    Specify a location in Amazon S3 to receive query results from Athena.
  6. Choose Save.

  7. Choose Editor to switch to the query editor.

    Choose Editor.

Creating a database

After you have set up a query results location, creating a database in the Athena console query editor is straightforward.

To create a database using the Athena query editor
  1. Open the Athena console at

  2. On the Editor tab, in the query editor, enter the Hive data definition language (DDL) command CREATE DATABASE myDataBase. Replace myDatabase with the name that you want to use. For restrictions on database names, see Names for tables, databases, and columns.

  3. Choose Run or press Ctrl+ENTER.

  4. To make your database the current database, select it from the Database menu on the left of the query editor.

For information about controlling permissions to Athena databases, see Fine-grained access to databases and tables in the Amazon Glue Data Catalog.