Cloudformation创建加密雅典娜胶水表

时间:2018-01-26 00:11:23

标签: amazon-cloudformation amazon-athena aws-glue

我有一个CF模板来创建一个从S3 CSV文件中读取的胶水表。

MyTableEncrypted:
    Type: AWS::Glue::Table
    Properties:
      DatabaseName:
        Ref: MyDatabase
      CatalogId:
        Ref: AWS::AccountId
      TableInput:
        Name:
          Fn::Sub: "my-table-encrypted"
        Parameters: { "classification" : "csv" }
        StorageDescriptor:
          Location:
            Fn::Sub: "s3://my-encrypted-bucket/"
          InputFormat: "org.apache.hadoop.mapred.TextInputFormat"
          OutputFormat: "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"
          SerdeInfo:
            Parameters: { "separatorChar" : "\t" }
            SerializationLibrary: "org.apache.hadoop.hive.serde2.OpenCSVSerde"
          StoredAsSubDirectories: false
          Columns:
            - Name: first_name
              Type: string
            - Name: last_name
              Type: string

我想在此表中添加TBLPROPERTIES {has_encrypted_data : false}。如何在CF模板中实现这一目标?

没有关于文档中加密属性的提示 - https://docs.aws.amazon.com/glue/latest/webapi/API_StorageDescriptor.html

1 个答案:

答案 0 :(得分:1)

has_encrypted_data附加到TableInput参数工作。

MyTableEncrypted:
    Type: AWS::Glue::Table
    Properties:
      DatabaseName:
        Ref: MyDatabase
      CatalogId:
        Ref: AWS::AccountId
      TableInput:
        Name:
          Fn::Sub: "my-table-encrypted"
        Parameters: { "classification" : "csv", "has_encrypted_data" : "true" }
        StorageDescriptor:
          Location:
            Fn::Sub: "s3://my-encrypted-bucket/"
          InputFormat: "org.apache.hadoop.mapred.TextInputFormat"
          OutputFormat: "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"
          SerdeInfo:
            Parameters: { "separatorChar" : "\t" }
            SerializationLibrary: "org.apache.hadoop.hive.serde2.OpenCSVSerde"
          StoredAsSubDirectories: false
          Columns:
            - Name: first_name
              Type: string
            - Name: last_name
              Type: string