Python AWS CDK – 将Redshift用作Kinesis Firehose的目标?

huangapple go评论49阅读模式
英文:

Python AWS CDK - Redshift as destination for kinesis firehose?

问题

我正在寻找一种在AWS CDK(Python)中将Redshift配置为Kinesis Firehose的目标的方法。与S3一样,我没有找到关于如何执行此操作的具体文档。

我正在研究这个链接(https://docs.aws.amazon.com/cdk/api/v1/docs/aws-kinesisfirehose-readme.html),但它似乎是一种较低级别的方法。

如果要使用这个方法,我应该将其放入目标字段吗?

英文:

I'm looking for a way to configure redshift as a destination for kinesis firehose with the aws cdk (python). I'm not seeing any specific documentation on doing this like you can with s3.

https://docs.aws.amazon.com/cdk/api/v1/docs/aws-kinesisfirehose-readme.html

I'm looking into this, but it seems like a lower level method.

If using this, should I just drop it into the destination field?

答案1

得分: 0

你分享的方法似乎是正确的方法。

如果你正在使用 TypeScript,可以按照以下方式编写:

// 下面的代码示例展示了如何实例化此类型。
// 这些值是占位符,你应该更改它们。
import { aws_kinesisfirehose as kinesisfirehose } from 'aws-cdk-lib';
const cfnDeliveryStream = new kinesisfirehose.CfnDeliveryStream(this, 'MyCfnDeliveryStream', /* 所有可选属性 */ {

  deliveryStreamName: 'deliveryStreamName',
  deliveryStreamType: 'deliveryStreamType',

  redshiftDestinationConfiguration: {
    clusterJdbcurl: 'clusterJdbcurl',
    copyCommand: {
      dataTableName: 'dataTableName',

      // 下面的属性是可选的
      copyOptions: 'copyOptions',
      dataTableColumns: 'dataTableColumns',
    },
    password: 'password',
    roleArn: 'roleArn',
    s3Configuration: {
      bucketArn: 'bucketArn',
      roleArn: 'roleArn',

      // 下面的属性是可选的
      bufferingHints: {
        intervalInSeconds: 123,
        sizeInMBs: 123,
      },
      cloudWatchLoggingOptions: {
        enabled: false,
        logGroupName: 'logGroupName',
        logStreamName: 'logStreamName',
      },
      compressionFormat: 'compressionFormat',
      encryptionConfiguration: {
        kmsEncryptionConfig: {
          awskmsKeyArn: 'awskmsKeyArn',
        },
        noEncryptionConfig: 'noEncryptionConfig',
      },
      errorOutputPrefix: 'errorOutputPrefix',
      prefix: 'prefix',
    },
    username: 'username',

    // 下面的属性是可选的
    cloudWatchLoggingOptions: {
      enabled: false,
      logGroupName: 'logGroupName',
      logStreamName: 'logStreamName',
    },
    processingConfiguration: {
      enabled: false,
      processors: [{
        type: 'type',

        // 下面的属性是可选的
        parameters: [{
          parameterName: 'parameterName',
          parameterValue: 'parameterValue',
        }],
      }],
    },
    retryOptions: {
      durationInSeconds: 123,
    },
    s3BackupConfiguration: {
      bucketArn: 'bucketArn',
      roleArn: 'roleArn',

      // 下面的属性是可选的
      bufferingHints: {
        intervalInSeconds: 123,
        sizeInMBs: 123,
      },
      cloudWatchLoggingOptions: {
        enabled: false,
        logGroupName: 'logGroupName',
        logStreamName: 'logStreamName',
      },
      compressionFormat: 'compressionFormat',
      encryptionConfiguration: {
        kmsEncryptionConfig: {
          awskmsKeyArn: 'awskmsKeyArn',
        },
        noEncryptionConfig: 'noEncryptionConfig',
      },
      errorOutputPrefix: 'errorOutputPrefix',
      prefix: 'prefix',
    },
    s3BackupMode: 's3BackupMode',
  },

});

文档链接

英文:

The one you have shared seems the right approach.

If you are using typescript, same can be written as below:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kinesisfirehose as kinesisfirehose } from 'aws-cdk-lib';
const cfnDeliveryStream = new kinesisfirehose.CfnDeliveryStream(this, 'MyCfnDeliveryStream', /* all optional props */ {
deliveryStreamName: 'deliveryStreamName',
deliveryStreamType: 'deliveryStreamType',
redshiftDestinationConfiguration: {
clusterJdbcurl: 'clusterJdbcurl',
copyCommand: {
dataTableName: 'dataTableName',
// the properties below are optional
copyOptions: 'copyOptions',
dataTableColumns: 'dataTableColumns',
},
password: 'password',
roleArn: 'roleArn',
s3Configuration: {
bucketArn: 'bucketArn',
roleArn: 'roleArn',
// the properties below are optional
bufferingHints: {
intervalInSeconds: 123,
sizeInMBs: 123,
},
cloudWatchLoggingOptions: {
enabled: false,
logGroupName: 'logGroupName',
logStreamName: 'logStreamName',
},
compressionFormat: 'compressionFormat',
encryptionConfiguration: {
kmsEncryptionConfig: {
awskmsKeyArn: 'awskmsKeyArn',
},
noEncryptionConfig: 'noEncryptionConfig',
},
errorOutputPrefix: 'errorOutputPrefix',
prefix: 'prefix',
},
username: 'username',
// the properties below are optional
cloudWatchLoggingOptions: {
enabled: false,
logGroupName: 'logGroupName',
logStreamName: 'logStreamName',
},
processingConfiguration: {
enabled: false,
processors: [{
type: 'type',
// the properties below are optional
parameters: [{
parameterName: 'parameterName',
parameterValue: 'parameterValue',
}],
}],
},
retryOptions: {
durationInSeconds: 123,
},
s3BackupConfiguration: {
bucketArn: 'bucketArn',
roleArn: 'roleArn',
// the properties below are optional
bufferingHints: {
intervalInSeconds: 123,
sizeInMBs: 123,
},
cloudWatchLoggingOptions: {
enabled: false,
logGroupName: 'logGroupName',
logStreamName: 'logStreamName',
},
compressionFormat: 'compressionFormat',
encryptionConfiguration: {
kmsEncryptionConfig: {
awskmsKeyArn: 'awskmsKeyArn',
},
noEncryptionConfig: 'noEncryptionConfig',
},
errorOutputPrefix: 'errorOutputPrefix',
prefix: 'prefix',
},
s3BackupMode: 's3BackupMode',
},
});

huangapple
  • 本文由 发表于 2023年6月15日 21:52:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76483200.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定