AWS Elasticsearch 生成 api-key
AWS Elasticsearch generate api-key
我使用 AWS CDK 在 AWS 中创建了一个弹性搜索服务。
本来想通过IAM访问的,但是在node里面的方式是horrible,所以转而通过api-key.
进行auth
如果我遵循 elasticsearch docs,我会收到以下错误:
AuthenticationException(401, '{"Message":"Your request: \'/_security/api_key\' is not allowed."}')
我假设这是因为我的默认用户没有访问 _security
API 的正确权限,但是我该如何创建所说的 api-key?
来自评论:
安全性 API 是 x-pack 的一部分,AWS Elasticserach 服务尚不支持。如果我们需要在 AWS 中使用它,可以选择将它用作来自 AWS MarketPlace 的 SAAS。但是,还有其他选项可以保护 AWS Elasticsearch:
- 使用 cognito 保护弹性,为具有身份池和 iam 角色的用户提供细粒度控制。 Here 是一些细节。
- 基于 IP Resource polices。只要客户端在网络 AWS/non-AWS 内,“*”主体的条件就限制在 cidr 范围内。任何人都可以访问,同一ip cidr范围内的用户没有细粒度访问。
- IAM 身份验证:提供细粒度控制,需要通过角色(也可以是单独的 cognito)或用户 cred 的 AWS 凭证,以使用 v4 签名对 http 请求进行签名。如果我们手动签署http请求,我们可以使用aws4-sign, We just need to pass, service, region and body to
aws4.sign
method options in addition to nodejs http request options. Similar to example here with service as es
. Couple of libraries which wraps this signing for elastic are aws-es-connection and http-aws-es
我使用 AWS CDK 在 AWS 中创建了一个弹性搜索服务。 本来想通过IAM访问的,但是在node里面的方式是horrible,所以转而通过api-key.
进行auth如果我遵循 elasticsearch docs,我会收到以下错误:
AuthenticationException(401, '{"Message":"Your request: \'/_security/api_key\' is not allowed."}')
我假设这是因为我的默认用户没有访问 _security
API 的正确权限,但是我该如何创建所说的 api-key?
来自评论:
安全性 API 是 x-pack 的一部分,AWS Elasticserach 服务尚不支持。如果我们需要在 AWS 中使用它,可以选择将它用作来自 AWS MarketPlace 的 SAAS。但是,还有其他选项可以保护 AWS Elasticsearch:
- 使用 cognito 保护弹性,为具有身份池和 iam 角色的用户提供细粒度控制。 Here 是一些细节。
- 基于 IP Resource polices。只要客户端在网络 AWS/non-AWS 内,“*”主体的条件就限制在 cidr 范围内。任何人都可以访问,同一ip cidr范围内的用户没有细粒度访问。
- IAM 身份验证:提供细粒度控制,需要通过角色(也可以是单独的 cognito)或用户 cred 的 AWS 凭证,以使用 v4 签名对 http 请求进行签名。如果我们手动签署http请求,我们可以使用aws4-sign, We just need to pass, service, region and body to
aws4.sign
method options in addition to nodejs http request options. Similar to example here with service ases
. Couple of libraries which wraps this signing for elastic are aws-es-connection and http-aws-es