Skip to content

Commit 34e6d73

Browse files
committed
Adding example S3 bucket permissions, with js syntax
1 parent 27ef02e commit 34e6d73

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

README.md

+72-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ec2 discovery allows to use the ec2 APIs to perform automatic discovery (similar
5454
aws:
5555
access_key: AKVAIQBF2RECL7FJWGJQ
5656
secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
57-
57+
5858
discovery:
5959
type: ec2
6060

@@ -110,6 +110,77 @@ The S3 repositories are using the same credentials as the rest of the S3 service
110110

111111
Multiple S3 repositories can be created. If the buckets require different credentials, then define them as part of the repository settings.
112112

113+
## Recommended S3 Permissions
114+
115+
In order to restrict the Elasticsearch snapshot process to the minimum required resources, we recommend using Amazon IAM in conjunction with pre-existing S3 buckets. Here is an example policy which will allow the snapshot access to an S3 bucket named "snaps.example.com". This may be configured through the AWS IAM console, by creating a Custom Policy, and using a Policy Document similar to this (changing snaps.example.com to your bucket name).
116+
117+
```js
118+
{
119+
"Statement": [
120+
{
121+
"Action": [
122+
"s3:ListBucket"
123+
],
124+
"Effect": "Allow",
125+
"Resource": [
126+
"arn:aws:s3:::snaps.example.com"
127+
]
128+
},
129+
{
130+
"Action": [
131+
"s3:GetObject",
132+
"s3:PutObject",
133+
"s3:DeleteObject"
134+
],
135+
"Effect": "Allow",
136+
"Resource": [
137+
"arn:aws:s3:::snaps.example.com/*"
138+
]
139+
}
140+
],
141+
"Version": "2012-10-17"
142+
}
143+
144+
```
145+
146+
You may further restrict the permissions by specifying a prefix within the bucket, in this example, named "foo".
147+
148+
```js
149+
{
150+
"Statement": [
151+
{
152+
"Action": [
153+
"s3:ListBucket"
154+
],
155+
"Condition": {
156+
"StringLike": {
157+
"s3:prefix": [
158+
"foo/*"
159+
]
160+
}
161+
},
162+
"Effect": "Allow",
163+
"Resource": [
164+
"arn:aws:s3:::snaps.example.com"
165+
]
166+
},
167+
{
168+
"Action": [
169+
"s3:GetObject",
170+
"s3:PutObject",
171+
"s3:DeleteObject"
172+
],
173+
"Effect": "Allow",
174+
"Resource": [
175+
"arn:aws:s3:::snaps.example.com/foo/*"
176+
]
177+
}
178+
],
179+
"Version": "2012-10-17"
180+
}
181+
182+
```
183+
113184
## Testing
114185

115186
Integrations tests in this plugin require working AWS configuration and therefore disabled by default. Three buckets and two iam users have to be created. The first iam user needs access to two buckets in different regions and the final bucket is exclusive for the other iam user. To enable tests prepare a config file elasticsearch.yml with the following content:

0 commit comments

Comments
 (0)