AWS::Athena::WorkGroup - AWS CloudFormation


The AWS::Athena::WorkGroup resource specifies an Amazon Athena workgroup, which contains a name, description, creation time, state, and other configuration, listed under WorkGroupConfiguration. Each workgroup enables you to isolate queries for you or your group from other queries in the same account. For more information, see CreateWorkGroup in the Amazon Athena API Reference.


To declare this entity in your AWS CloudFormation template, use the following syntax:


{ "Type" : "AWS::Athena::WorkGroup", "Properties" : { "Description" : String, "Name" : String, "RecursiveDeleteOption" : Boolean, "State" : String, "Tags" : [ Tag, ... ], "WorkGroupConfiguration" : WorkGroupConfiguration } }


Type: AWS::Athena::WorkGroup Properties: Description: String Name: String RecursiveDeleteOption: Boolean State: String Tags: - Tag WorkGroupConfiguration: WorkGroupConfiguration



The workgroup description.

Required: No

Type: String

Minimum: 0

Maximum: 1024

Update requires: No interruption


The workgroup name.

Required: Yes

Type: String

Pattern: [a-zA-Z0-9._-]{1,128}

Update requires: Replacement


The option to delete a workgroup and its contents even if the workgroup contains any named queries. The default is false.

Required: No

Type: Boolean

Update requires: No interruption


The state of the workgroup: ENABLED or DISABLED.

Required: No

Type: String

Allowed values: DISABLED | ENABLED

Update requires: No interruption


The tags (key-value pairs) to associate with this resource.

Required: No

Type: List of Tag

Update requires: No interruption


The configuration of the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether Amazon CloudWatch Metrics are enabled for the workgroup, and the limit for the amount of bytes scanned (cutoff) per query, if it is specified. The EnforceWorkGroupConfiguration option determines whether workgroup settings override client-side query settings.

Required: No

Type: WorkGroupConfiguration

Update requires: No interruption

Return values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the name of the WorkGroup. For example:

{ "Ref": "myWorkGroup" }

For more information about using the Ref function, see Ref.


The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.


The date and time the workgroup was created, as a UNIX timestamp in seconds. For example: 1582761016.


Not currently supported by AWS CloudFormation.


Creating an Athena WorkGroup

The following example template creates the Athena WorkGroup MyCustomWorkGroup. Note the use of WorkGroupConfiguration to specify the configuration for the WorkGroup.


Resources: MyAthenaWorkGroup: Type: AWS::Athena::WorkGroup Properties: Name: MyCustomWorkGroup Description: My WorkGroup State: ENABLED Tags: - Key: "key1" Value: "value1" - Key: "key2" Value: "value2" WorkGroupConfiguration: BytesScannedCutoffPerQuery: 200000000 EnforceWorkGroupConfiguration: false PublishCloudWatchMetricsEnabled: false RequesterPaysEnabled: true ResultConfiguration: OutputLocation: s3://path/to/my/bucket/


{ "Resources":{ "MyAthenaWorkGroup":{ "Type":"AWS::Athena::WorkGroup", "Properties":{ "Name":"MyCustomWorkGroup", "Description":"My WorkGroup", "State":"ENABLED", "Tags":[ { "Key":"key1", "Value":"value1" }, { "Key":"key2", "Value":"value2" } ], "WorkGroupConfiguration":{ "BytesScannedCutoffPerQuery":200000000, "EnforceWorkGroupConfiguration":false, "PublishCloudWatchMetricsEnabled":false, "RequesterPaysEnabled":true, "ResultConfiguration":{ "OutputLocation":"s3://path/to/my/bucket/" } } } } } }

Updating an Athena WorkGroup

The following example template updates the Athena WorkGroup MyCustomWorkGroup. Note the use of WorkGroupConfigurationUpdates instead of WorkGroupConfiguration.


Resources: MyAthenaWorkGroup: Type: AWS::Athena::WorkGroup Properties: Name: MyCustomWorkGroup Description: My WorkGroup Updated State: DISABLED Tags: - Key: "key1" Value: "value1" - Key: "key2" Value: "value2" WorkGroupConfigurationUpdates: BytesScannedCutoffPerQuery: 10000000 EnforceWorkGroupConfiguration: true PublishCloudWatchMetricsEnabled: true RequesterPaysEnabled: false ResultConfigurationUpdates: EncryptionConfiguration: EncryptionOption: SSE_S3 OutputLocation: s3://path/to/my/bucket/updated/


{ "Resources":{ "MyAthenaWorkGroup":{ "Type":"AWS::Athena::WorkGroup", "Properties":{ "Name":"MyCustomWorkGroup", "Description":"My WorkGroup Updated", "State":"DISABLED", "Tags":[ { "Key":"key1", "Value":"value1" }, { "Key":"key2", "Value":"value2" } ], "WorkGroupConfigurationUpdates":{ "BytesScannedCutoffPerQuery":10000000, "EnforceWorkGroupConfiguration":true, "PublishCloudWatchMetricsEnabled":true, "RequesterPaysEnabled":false, "ResultConfigurationUpdates":{ "EncryptionConfiguration":{ "EncryptionOption":"SSE_S3" }, "OutputLocation":"s3://path/to/my/bucket/updated/" } } } } } }