我正在创建一个“firehose”cloudformation 模板,最终将数据推送到 redshift
它看起来像这样:
{
"Resources": {
"Role1" : {},// this role permits access to S3 and Redshift
"S3Bucket" : {} // configuration for S3 bucket where firehose places data before pushing it to redshift
"RedshiftCluster": {} // configuration for redshift cluster
"FirehoseStream": {
... some properties here
"RedshiftDestinationConfiguration" : {
"ClusterJDBCURL": {
"Fn::GetAtt": [
"RedshiftCluster",
"ClusterJDBCURL"
]
}
},
}
}
}
我收到的错误是:
Template validation error: Template error: resource RedshiftCluster does not support attribute type ClusterJDBCURL in Fn::GetAtt
根据文档,ClusterJDBCURL 的值必须是“字符串”。但是,在设置 redshift 集群之前我不会知道该字符串的值。
那么我应该如何提供这个值?
最佳答案
AWS::Redshift::Cluster类型没有 ClusterJDBCURL 属性。 然而,我们可以使用 Fn::Sub 构建一个.
基于Obtain the JDBC Url文档中,JDBC Url 的格式为 jdbc:redshift://<endpoint>:<port>/<database>
.
所以,如果你替换 <database>
在以下带有数据库名称的示例中,您应该会得到您要查找的内容。
{
"Resources": {
"Role1" : {},// this role permits access to S3 and Redshift
"S3Bucket" : {} // configuration for S3 bucket where firehose places data before pushing it to redshift
"RedshiftCluster": {} // configuration for redshift cluster
"FirehoseStream": {
... some properties here
"RedshiftDestinationConfiguration" : {
"ClusterJDBCURL": {
"Fn::Sub": "jdbc:redshift://${RedshiftCluster.Endpoint.Address}:${RedshiftCluster.Endpoint.Port}/<database>"
}
},
}
}
}
关于amazon-web-services - 创建 firehose cloudformation 模板时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46921451/