Athena runs a DDL statement against the Glue Data Catalog with the
caller's identity, so on AWS a caller without the Glue permissions a
statement needs starts the query, and the query fails with
"Insufficient permissions to execute the query." and the Glue denial.
Floci never checked them: under IAM enforcement a caller holding only
athena:* created and dropped Glue databases and tables through Athena.
Neither botocore nor the Service Reference says which Glue actions a
statement needs. Athena's user guide does, in its table "Examples of
database and table-level permissions":
- tools/aws/fetch_athena_glue_ddl_permissions.py vendors that table as
it stands into tools/aws/sources/athena-glue-ddl-permissions.json:
each statement's sentence and example policy, and the sentence that
names the example database and table. --verify compares the file
with the live page, and athena-glue-ddl-permissions.prompt.md says
how to rebuild it when the page's layout changes.
- regen_iam_request_resources.py reads it as a source of the IAM
request table (STATEMENT_SOURCES, for this table alone). Each action
of a policy statement acts on each of its resources whose type the
Service Reference gives the action, the type whose format the example
ARN matches, its variables filled with what the page says the example
names stand for. The table gains statementActions, the reference's
types for each action, and statements. --check derives both offline,
and --verify checks the types and the page. The sync also carries
the Service Reference's changes since the last one.
- IamEnforcementFilter.statementRefusal checks those requests as the
caller, the way a forwarded request is checked (aws:ViaAWSService,
the caller's keys, the resource's policy), and returns AWS's denial.
authorizeAdditionalResource's caller and decision steps move into
helpers the two share.
- AthenaService checks CREATE DATABASE, CREATE [EXTERNAL] TABLE, DROP
TABLE and MSCK REPAIR TABLE in the default catalog before running
them, naming the database and table lowercase as Glue stores them
(GlueService.normalizeName), and a denial fails the query with
AWS's reason. As the guide says, DROP TABLE of a table without
partitions needs no partition action; a table Glue cannot read for
another reason fails the query.
AthenaGluePermissionsIntegrationTest runs the guide's policies under
IAM enforcement, and a deny on a lowercase name against a query that
spells it in capitals. RequestResourcesTest and the generator's and
fetch script's tests cover the rest, and athena.md says so.