Workgroups and query controls - Amazon Athena
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

Workgroups and query controls

To run queries on DuckDB, create a workgroup and choose DuckDB specifically for the Athena engine version.

Create a workgroup

To create a DuckDB workgroup in the console
  1. In the Athena console navigation pane, under Administration, choose Workgroups.

  2. Choose Create workgroup.

  3. For Workgroup name, enter a name.

  4. Under Athena engine version, for Engine version, choose DuckDB.

  5. (Optional) Under Encrypt query results, choose to use your own AWS KMS key. For more information, see Use managed query results.

  6. (Optional) To change workgroup settings such as Override client-side settings, under Additional configurations, turn off Use defaults.

  7. Choose Create workgroup.

To create the workgroup with the AWS CLI or the API, set the engine version in EngineVersion.SelectedEngineVersion. If you create a workgroup without an engine version, Athena uses automatic engine selection, which runs queries on Athena engine version 3. Automatic engine selection doesn't choose DuckDB.

aws athena create-work-group \ --name my-duckdb-workgroup \ --configuration '{ "EngineVersion": { "SelectedEngineVersion": "DuckDB" } }' \ --region <your-region-here>

Keep these points in mind when you create the workgroup:

  • The first time that you create a DuckDB workgroup in an account, Athena creates the service-linked role AWSServiceRoleForAmazonAthena with your credentials. Your principal needs permission for iam:CreateServiceLinkedRole. Alternatively, an administrator can create the role once for the account by running aws iam create-service-linked-role --aws-service-name ops.athena.amazonaws.com. For more information, see Athena service-linked role.

  • If you don't set PublishCloudWatchMetricsEnabled, Athena sets it to true and publishes query metrics for the workgroup to CloudWatch in your account. To turn this off, set it to false. When you switch an existing workgroup to DuckDB, the workgroup keeps its current setting.

  • You do not require a query result location by default. Athena stores results in managed query results for the workgroup. You can optionally configure a query result location in ResultConfiguration.

  • You cannot name a workgroup duckdb, athena-duckdb, or athenaduckdb, in any combination of uppercase and lowercase letters.

  • If you query data in Requester Pays buckets, turn on the workgroup's Requester Pays setting.

  • In the engine configuration, only the athena-execution-properties classification is accepted.

The CreateWorkGroup API rejects the following settings on a DuckDB workgroup:

  • CustomerContentEncryptionConfiguration

  • IdentityCenterConfiguration

  • QueryResultsS3AccessGrantsConfiguration

  • ExecutionRole

  • EngineConfiguration with the athena-query-engine-properties classification (use athena-execution-properties)

  • MonitoringConfiguration

Once you create a workgroup, you may call GetWorkGroup. In the response, EngineVersion.EffectiveEngineVersion is DuckDB.