Skip to content
This repository was archived by the owner on Oct 31, 2018. It is now read-only.

Commit f27af20

Browse files
committed
Minor README cleanup
1 parent ba53cf7 commit f27af20

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

README.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,58 @@
22

33
## Description
44

5-
Resizes images on the fly using Amazon S3, AWS Lambda, and Amazon API Gateway. Using a conventional URL structure and S3 static website hosting with redirection rules, requests for resized images are redirected to a Lambda function via API Gateway which will resize the image, upload it to S3, and redirect the requestor to the resized image. The next request for the resized image will be served from S3 directly.
5+
Resizes images on the fly using Amazon S3, AWS Lambda, and Amazon API Gateway.
6+
Using a conventional URL structure and S3 static website hosting with
7+
redirection rules, requests for resized images are redirected to a Lambda
8+
function via API Gateway which will resize the image, upload it to S3, and
9+
redirect the requestor to the resized image. The next request for the resized
10+
image will be served from S3 directly.
611

712
## Usage
813

914
1. Build the Lambda function
1015

11-
The Lambda function uses [sharp][sharp] for image resizing which requires native extensions. In order to run on Lambda, it must be packaged on Amazon Linux. You can accomplish this in one of two ways:
16+
The Lambda function uses [sharp][sharp] for image resizing which requires
17+
native extensions. In order to run on Lambda, it must be packaged on Amazon
18+
Linux. You can accomplish this in one of two ways:
1219

13-
- Upload the contents of the `lambda` subdirectory to a [Amazon EC2 instance running Amazon Linux][amazon-linux] and run `npm install`, or
20+
- Upload the contents of the `lambda` subdirectory to an [Amazon EC2 instance
21+
running Amazon Linux][amazon-linux] and run `npm install`, or
1422

15-
- Use the Amazon Linux Docker container image to build the package using your local system. This repo includes Makefile that will download Amazon Linux, install Node.js and developer tools, and build the extensions using Docker. Run `make all`.
23+
- Use the Amazon Linux Docker container image to build the package using your
24+
local system. This repo includes Makefile that will download Amazon Linux,
25+
install Node.js and developer tools, and build the extensions using Docker.
26+
Run `make all`.
1627

1728
2. Deploy the CloudFormation stack
1829

19-
Run `bin/deploy` to deploy the CloudFormation stack. It will create a temporary Amazon S3 bucket, package and upload the function, and create the Lambda function, Amazon API Gateway RestApi, and an S3 bucket for images via CloudFormation.
30+
Run `bin/deploy` to deploy the CloudFormation stack. It will create a
31+
temporary Amazon S3 bucket, package and upload the function, and create the
32+
Lambda function, Amazon API Gateway RestApi, and an S3 bucket for images via
33+
CloudFormation.
2034

21-
The deployment script requires the [AWS CLI][cli] version 1.11.19 or newer to be installed.
35+
The deployment script requires the [AWS CLI][cli] version 1.11.19 or newer to
36+
be installed.
2237

2338
3. Test the function
2439

25-
Upload an image to the S3 bucket and try to resize it via your web browser to different sizes, e.g. with an image uploaded in the bucket called image.png:
40+
Upload an image to the S3 bucket and try to resize it via your web browser to
41+
different sizes, e.g. with an image uploaded in the bucket called image.png:
2642

27-
- http://[BucketWebsiteHost]/300x300/path/to/image.png
28-
- http://[BucketWebsiteHost]/90x90/path/to/image.png
29-
- http://[BucketWebsiteHost]/40x40/path/to/image.png
43+
- http://[BucketWebsiteHost]/300x300/path/to/image.png
44+
- http://[BucketWebsiteHost]/90x90/path/to/image.png
45+
- http://[BucketWebsiteHost]/40x40/path/to/image.png
3046

31-
You can find the BucketWebsiteUrl in the table of outputs displayed on a successful invocation of the deploy script.
47+
You can find the `BucketWebsiteUrl` in the table of outputs displayed on a
48+
successful invocation of the deploy script.
3249

33-
**Note:** If you create the Lambda function yourself, make sure to select Node.js version 6.10.
50+
4. (Optional) Restrict resize dimensions
3451

35-
4. Restrict resize dimensions
36-
37-
To restrict the resolutions client services can convert images to, set the environment variable ```ALLOWED_DIMENSIONS``` to a string in the format *(HEIGHT)x(WIDTH),(HEIGHT)x(WIDTH),...(HEIGHT)x(WIDTH)*.
38-
For example: *300x300,90x90,40x40*.
52+
To restrict the dimensions the function will create, set the environment
53+
variable `ALLOWED_DIMENSIONS` to a string in the format
54+
*(HEIGHT)x(WIDTH),(HEIGHT)x(WIDTH),...*.
3955

56+
For example: *300x300,90x90,40x40*.
4057

4158
## License
4259

0 commit comments

Comments
 (0)