Amazon Athena
User Guide

Table Location in Amazon S3

When you run a CREATE TABLE query in Athena, you register your table with the data catalog that Athena uses. If you migrated to AWS Glue, this is the catalog from AWS Glue. You also specify the location in Amazon S3 for your table in this format: s3://bucketname/keyname/.

Use these tips and examples when you specify the location in Amazon S3.

  • Athena reads all files in an Amazon S3 location you specify in the CREATE TABLE statement, and cannot ignore any files included in the prefix. When you create tables, include in the Amazon S3 path only the files you want Athena to read. Use AWS Lambda functions to scan files in the source location, remove any empty files, and move unneeded files to another location.

  • In the LOCATION clause, use a trailing slash for your bucket.



Do not use any of the following items in file locations.

  • Do not use filenames, underscores, wildcards, or glob patterns for specifying file locations.

  • Do not add the full HTTP notation, such as to the Amazon S3 bucket path.

  • Do not use empty prefixes (with the extra /) in the path, as follows: S3://bucketname/prefix//prefix/. While this is a valid Amazon S3 path, Athena does not allow it and changes it to s3://bucketname/prefix/prefix/, removing the extra /.

Do not use:

s3://path_to_bucket s3://path_to_bucket/* s3://path_to_bucket/mySpecialFile.dat s3://bucketname/prefix/filename.csv s3:// S3://bucket/prefix//prefix/ arn:aws:s3:::bucketname/prefix