我想啓動一個CodeBuild項目來運行我的集成測試。我的應用程序使用AWS ElasticSearch服務作爲Hibernate Search索引存儲。用於CodeBuild集成的AWS Elastisearch訪問策略使用Hibernate搜索使用ElasticSearch進行索引存儲搜索
我已經向我的ES域添加了一個策略,允許私有EC2實例通過NAT網關訪問ES。不幸的是,我無法想出允許CodeBuild訪問ES的正確策略。當我運行CodeBuild項目時,當Hibernate嘗試檢查索引存在時,我得到一個403錯誤。
Caused by: org.hibernate.search.exception.SearchException: HSEARCH400007: Elasticsearch request failed.
Request:
Operation: IndicesExists
URI:com.mycompany.myproject.model.tenant
Data:
null
Response:
=========
Status: 403
Error message: 403 Forbidden
Cluster name: null
Cluster status: null
我試圖配置ES訪問策略,以允許開放接入域,然後測試運行正常(「AWS」:「*」)。
這是ES訪問策略
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::AWS_ACCOUNT_ID:role/CodeBuildRole-XXXXXXXX"
},
"Action": "es:*",
"Resource": "arn:aws:es:eu-west-1:AWS_ACOUNT_ID:domain/elastic-search-domain/*"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws:es:eu-west-1:AWS_ACCOUNT_ID:domain/elastic-search-domain/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "NAT_GW_IP"
}
}
}
]
}
爲主要我也試過如下:
"arn:aws:sts::AWS_ACCOUNT_ID:assumed-role/CodeBuildRole-XXXXXXXXX/*"
"arn:aws:iam::AWS_ACCOUNT_ID:role/CodeBuildRole-XXXXXXXXX"
"arn:aws:iam::AWS_ACCOUNT_ID:root"
"arn:aws:iam::AWS_ACCOUNT_ID:user/MI_USER_ADMIN"
任何幫助將是非常讚賞。
謝謝
我們在Hibernate Search上取得了一些很好的進展:http://in.relation.to/2017/06/13/hibernate-search-5-8-0-Beta3/ – Sanne