amazon-web-services - 如何使用 Cloudformation 更新 Athena 输出位置

标签 amazon-web-services aws-cloudformation amazon-athena

有人可以帮我编写一个云形成脚本来更新 Athena 主工作组的输出位置。当我运行下面的代码时,收到错误消息“提供的请求无效:无法创建主工作组(服务:Athena,状态代码:400,请求 ID:9945209c-6999-4e8b-bd3d-a3af13b4ac4f​​)”

Resources:
  MyAthenaWorkGroup:
    Type: AWS::Athena::WorkGroup
    Properties:
      Name: primary
      Description: My WorkGroup Updated
      State: DISABLED
      WorkGroupConfigurationUpdates:
        BytesScannedCutoffPerQuery: 10000000
        EnforceWorkGroupConfiguration: true
        PublishCloudWatchMetricsEnabled: true
        RequesterPaysEnabled: false
        ResultConfigurationUpdates:
          EncryptionConfiguration:
            EncryptionOption: SSE_S3          
          OutputLocation: s3://test/

最佳答案

您需要“创建一个更改集以将现有资源导入新的或现有的堆栈。”,因为“主”工作组是在您的堆栈外部创建的。 因此,您需要使用选项:“使用现有资源创建堆栈”:

enter image description here


您还需要添加DeletionPolicy/UpdateReplacePolicy。 一个完整的工作示例是:

  Resources:
    AthenaPrimaryWorkGroup:
      Type: AWS::Athena::WorkGroup
      Properties:
        Name: primary
        State: ENABLED
        WorkGroupConfigurationUpdates:
          BytesScannedCutoffPerQuery: 1000000000
          EnforceWorkGroupConfiguration: true
          PublishCloudWatchMetricsEnabled: true
          RequesterPaysEnabled: false
          ResultConfigurationUpdates:
            OutputLocation: s3://MY-Athena-results
      DeletionPolicy: Retain
      UpdateReplacePolicy: Retain

更多详细信息请访问:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html

关于amazon-web-services - 如何使用 Cloudformation 更新 Athena 输出位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61200196/

相关文章:

amazon-web-services - 如果 CloudFormation 中的条件和 Ref 为假,会发生什么?

json - aws athena - 通过 json 对象数组创建表

amazon-web-services - 亚马逊 ELB 上的 Laravel 4 : Undefined property: $attributes

amazon-web-services - AWS云形成: Inbound rules not getting added with this cloud formation template

amazon-web-services - AWS CDK : How can I deploy multiple stack from a single stack

create-table - Amazon Athena-根据查询结果创建表时如何排除元数据

aws-cloudformation - 使用模板创建 Athena 工作组

amazon-web-services - AWS Lex - 从用户问题中选择查询

node.js - 使用 elasticsearch 客户端时主机 header 无效

amazon-web-services - CloudFormation YAML - 带有条件语句的 IAM 策略