AWS::Athena::WorkGroup - AWS CloudFormation

AWS::Athena::WorkGroup

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.

Syntax

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

JSON

{ "Type" : "AWS::Athena::WorkGroup", "Properties" : { "Description" : String, "Name" : String, "RecursiveDeleteOption" : Boolean, "State" : String, "Tags" : Tags, "WorkGroupConfiguration" : WorkGroupConfiguration, "WorkGroupConfigurationUpdates" : WorkGroupConfigurationUpdates } }

Properties

Description

The workgroup description.

Required: No

Type: String

Minimum: 0

Maximum: 1024

Update requires: No interruption

Name

The workgroup name.

Required: Yes

Type: String

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

Update requires: Replacement

RecursiveDeleteOption

The option to delete the workgroup and its contents even if the workgroup contains any named queries or query executions.

Required: No

Type: Boolean

Update requires: No interruption

State

The state of the workgroup: ENABLED or DISABLED.

Required: No

Type: String

Allowed values: DISABLED | ENABLED

Update requires: No interruption

Tags

An array of key-value pairs to apply to this resource.

For more information, see Tag.

Required: No

Type: Tags

Update requires: No interruption

WorkGroupConfiguration

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

WorkGroupConfigurationUpdates

The configuration information that will be updated for this workgroup, which includes the location in Amazon S3 where query results are stored, the encryption option, if any, used for query results, whether the Amazon CloudWatch Metrics are enabled for the workgroup, whether the workgroup settings override the client-side settings, and the data usage limit for the amount of bytes scanned per query, if it is specified.

Required: No

Type: WorkGroupConfigurationUpdates

Update requires: No interruption

Return values

Ref

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.

Fn::GetAtt

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.

CreationTime

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

Examples

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.

YAML

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/

JSON

{ "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.

YAML

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/

JSON

{ "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/" } } } } } }