您可以使用基于IAM和IP地址的访问来设置访问策略。
- EC2实例需要具有
arn:aws:iam::aws:policy/AmazonESFullAccess
策略的配置文件 - 策略应包含两个语句:第一个列出IAM访问,第二个列出IP访问。
这是一个示例策略(语句顺序很重要!)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::xxxxxxxxxxxx:root" }, "Action": "es:*", "Resource": "arn:aws:es:us-west-2:xxxxxxxxxxxx:domain/my-elasticsearch-domain/*" }, { "Sid": "", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "es:*", "Resource": "arn:aws:es:us-west-2:xxxxxxxxxxxx:domain/my-elasticsearch-domain/*", "Condition": { "IpAddress": { "aws:SourceIp": [ "192.168.1.0", "192.168.1.1" ] } } } ]}


