[英]Update AWS Athena workgroup using CloudFormation template
I have 2 templates those I have taken from the AWS::Athena::WorkGroup - AWS CloudFormation documentation.我有 2 个模板,这些模板来自AWS::Athena::WorkGroup - AWS CloudFormation文档。
The first template athena_create.yaml
works as expected.第一个模板athena_create.yaml
按预期工作。 The second template needs to modify the workgroup created in the first template.第二个模板需要修改第一个模板中创建的工作组。 But I get an error:但我收到一个错误:
MyCustomWorkGroup already exists in stack arn:aws:cloudformation:us-east-1:XXX:stack/a1/7cc670a0-8d19-11ea-872c-12217e59f19f MyCustomWorkGroup 已存在于堆栈 arn:aws:cloudformation:us-east-1:XXX:stack/a1/7cc670a0-8d19-11ea-872c-12217e59f19f
Here is the code.这是代码。 create template works correctly.创建模板正常工作。
athena_create.yaml athena_create.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/
athena_update.yaml athena_update.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/
The update template mentioned above does not work as expected.上面提到的更新模板没有按预期工作。
The reason for the error is that the two templates were used to create two independent stacks.错误的原因是这两个模板用于创建两个独立的堆栈。 This didn't work because they two Athena WorkGroups of same Name: MyCustomWorkGroup
.这不起作用,因为他们有两个同名的 Athena 工作组: MyCustomWorkGroup
。
The correct way to perform create and update the MyCustomWorkGroup
is as follows:执行创建和更新MyCustomWorkGroup
的正确方法如下:
Create a stack using athena_create.yaml
file.使用athena_create.yaml
文件创建堆栈。
Once the stack is created, use its Update
option to upload athena_update.yaml
which is going to update the stack.创建堆栈后,使用其Update
选项上传将更新堆栈的athena_update.yaml
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.