Skip to content

Commit 923b1b3

Browse files
RobinDaughertyghedamat
authored andcommitted
Instructions to set up public access to S3 (#86)
* Provide instructions for public access to S3 * Improve instructions a little more * Explain development vs production-like environment
1 parent 3ceba6e commit 923b1b3

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,17 @@ The following properties are expected to be present on the deployment `context`
229229

230230
## Configuring Amazon S3
231231

232-
### Minimum S3 Permissions
232+
### Deployment user and S3 permissions
233233

234-
Ensure you have the minimum required permissions configured for the user (accessKeyId). A bare minimum policy should have the following permissions:
234+
The environment in which the `ember deploy` command is run needs to have an AWS account with a policy that allows writing to the S3 bucket.
235235

236-
```
236+
It's common for a development machine to be set up with the developer's personal AWS credentials, which likely have the ability to administer the entire AWS account. This will allow deployment to work from the development machine, but it is not a good idea to copy your personal credentials to production.
237+
238+
The best way to set up non-development deployment is to create an IAM user to be the "deployer", and [place its security credentials][9] (Access Key ID and Access Secret) in the environment on the machine or CI environment where deployment takes place. (The easiest way to do this in CI is to set environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.)
239+
240+
A bare minimum policy should have the following permissions:
241+
242+
```js
237243
{
238244
"Statement": [
239245
{
@@ -245,20 +251,45 @@ Ensure you have the minimum required permissions configured for the user (access
245251
"s3:PutObjectACL"
246252
],
247253
"Resource": [
248-
"arn:aws:s3:::<your-s3-bucket-name>/*"
254+
"arn:aws:s3:::your-s3-bucket-name/*"
249255
]
250256
}
251257
]
252258
}
259+
```
260+
261+
Replace `your-s3-bucket-name` with the name of the actual bucket you are deploying to.
253262

263+
Also, remember that "PutObject" permission will effectively overwrite any existing files with the same name unless you use a fingerprinting or a manifest plugin.
264+
265+
### S3 policy for public access
266+
267+
If you want the contents of the S3 bucket to be accessible to the world, the following policy can be placed directly in the S3 bucket policy:
268+
269+
```js
270+
{
271+
"Statement": [
272+
{
273+
"Sid": "Stmt1EmberCLIS3AccessPolicy",
274+
"Effect": "Allow",
275+
"Action": [
276+
"s3:GetObject",
277+
],
278+
"Resource": [
279+
"arn:aws:s3:::your-s3-bucket-name/*"
280+
]
281+
}
282+
]
283+
}
254284
```
255-
Replace <your-s3-bucket-name> with the name of the actual bucket you are deploying to. Also, remember that "PutObject" permission will effectively overwrite any existing files with the same name unless you use a fingerprinting or a manifest plugin.
285+
286+
Replace `your-s3-bucket-name` with the name of the actual bucket you are deploying to.
256287

257288
### Sample CORS configuration
258289

259290
To properly serve certain assets (i.e. webfonts) a basic CORS configuration is needed
260291

261-
```
292+
```xml
262293
<?xml version="1.0" encoding="UTF-8"?>
263294
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
264295
<CORSRule>
@@ -287,3 +318,4 @@ Some more info: [Amazon CORS guide][7], [Stackoverflow][8]
287318
[6]: http://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html "AWS Security Token Service guide"
288319
[7]: http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html "Amazon CORS guide"
289320
[8]: http://stackoverflow.com/questions/12229844/amazon-s3-cors-cross-origin-resource-sharing-and-firefox-cross-domain-font-loa?answertab=votes#tab-top "Stackoverflow"
321+
[9]: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files "AWS Configuration"

0 commit comments

Comments
 (0)