【发布时间】:2021-11-20 11:34:23
【问题描述】:
我正在尝试在 GCP 项目中部署 Apache Beam 批处理管道。我的管道将从 AWS OpenSearch 中的 Elasticsearch 集群中读取数据。
这是我为做同样的事情而编写的代码:
ElasticSearchOptions options = PipelineOptionsFactory.fromArgs(args).withValidation()
.as(ElasticSearchOptions.class);
Pipeline pipeline = Pipeline.create(options);
options.setAwsCredentialsProvider(
new AWSStaticCredentialsProvider(new BasicAWSCredentials(
options.getAwsAccessKey(),
options.getAwsSecretKey()
)
)
);
options.setAwsRegion("us-east-1");
PCollection<String> output =
pipeline.apply(
ElasticsearchIO.read().withConnectionConfiguration(
ElasticsearchIO.ConnectionConfiguration.create(
<hostName>,
options.getElasticSearchIndex(),
options.getElasticSearchType()
)
)
.withQuery("field_name:some-value")
);
我遇到了一个错误
403: User anonymous is not authorized to perform: es:ESHTTPGet
为了更好地理解这个错误,我从我的工作节点打印了 AWS 密钥和访问密钥,以确保传递的值得到正确处理。确实如此!
我被困在这一点上。如何使用我的 AWS 凭证(访问和密钥)授权自己并签署我对 Elasticsearch Read 运算符的请求?
【问题讨论】:
标签: amazon-web-services elasticsearch google-cloud-dataflow apache-beam