简体   繁体   中英

AWS cloud formation glue table reusable template

I have a lot of resources type AWS::Glue::Table in my aws templates. And I do not wont to copy-paste snippet of code from template to template. So idea is to create a reusable nested stack that accepts the params. I did it but one problem is still remaining. I do not know how I can pass columns via params to this stack [{Type: string, Name: type}, {Type: string, Name: timeLogged}] - it is an array of objects. But params accepts an only string type.

I tried to do something like this: !Split [ "," , "{Type: string, Name: type}, {Type: string, Name: timeLogged}"] - but its did not helped

AWSTemplateFormatVersion: 2010-09-09
Description: The AWS CloudFormation template for creating a Glue table
Parameters:
  DestinationBucketName:
    Type: String
    Description: Destination Regional Bucket Name
  DestinationBucketPrefix:
    Type: String
    Description: Destination Regional Bucket Prefix
  DatabaseName:
    Type: String
    Description: Database for Kinesis Analytics
  TableName:
    Type: String
    Description: Table for Kinesis Analytics
  InputFormat:
    Type: String
    Description: Input format for data
  OutputFormat:
    Type: String
    Description: Output format for data
  SerializationLibrary:
    Type: String
    Description: Serialization library for converting data

Resources:
  LogsCollectionTable:
    Type: AWS::Glue::Table
    Properties:
      DatabaseName: !Ref DatabaseName
      CatalogId: !Ref AWS::AccountId
      TableInput:
        Name: !Ref TableName
        Description: Table for storing data
        TableType: EXTERNAL_TABLE
        StorageDescriptor:
          Columns: [{Type: string, Name: type}, {Type: string, Name: timeLogged}]
          Location: !Sub s3://${DestinationBucketName}/${DestinationBucketPrefix}
          InputFormat: !Ref InputFormat
          OutputFormat: !Ref OutputFormat
          SerdeInfo:
            SerializationLibrary: !Ref SerializationLibrary

Short answer: You currently can not. You would need to pass every parameter manually.

在此处输入图片说明

Source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM