

# Workgroups and query controls

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

## Create a workgroup
<a name="athena-duckdb-workgroups-create-a-workgroup"></a>

**To create a DuckDB workgroup in the console**

1. In the Athena console navigation pane, under **Administration**, choose **Workgroups**.

1. Choose **Create workgroup**.

1. For **Workgroup name**, enter a name.

1. Under **Athena engine version**, for **Engine version**, choose **DuckDB**.

1. (Optional) Under **Encrypt query results**, choose to use your own AWS KMS key. For more information, see [Use managed query results](duckdb-query-results-storage.md#athena-duckdb-query-results-storage-managed).

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

1. 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. 

```bash
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](duckdb-permissions.md#athena-duckdb-permissions-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. 