Skip to content

Commit fb8e8e8

Browse files
committed
update README to match developer hub template
1 parent 432b096 commit fb8e8e8

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

README.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
# Serverless image resizer
22

3-
[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/thrau/serverless-image-resizer/releases/download/v0.1.0/serverless-image-resizer-cloudpod-v0.1.0.zip)
4-
5-
6-
A serverless application that demos several AWS functionalities on LocalStack:
7-
* S3
3+
[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/thrau/serverless-image-resizer/releases/download/v1.0.0/serverless-image-resizer-cloudpod-v1.0.0.zip)
4+
5+
| Key | Value |
6+
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7+
| Environment | <img src="https://img.shields.io/badge/LocalStack-deploys-4D29B4.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAKgAAACoABZrFArwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALbSURBVHic7ZpNaxNRFIafczNTGIq0G2M7pXWRlRv3Lusf8AMFEQT3guDWhX9BcC/uFAr1B4igLgSF4EYDtsuQ3M5GYrTaj3Tmui2SpMnM3PlK3m1uzjnPw8xw50MoaNrttl+r1e4CNRv1jTG/+v3+c8dG8TSilHoAPLZVX0RYWlraUbYaJI2IuLZ7KKUWCisgq8wF5D1A3rF+EQyCYPHo6Ghh3BrP8wb1en3f9izDYlVAp9O5EkXRB8dxxl7QBoNBpLW+7fv+a5vzDIvVU0BELhpjJrmaK2NMw+YsIxunUaTZbLrdbveZ1vpmGvWyTOJToNlsuqurq1vAdWPMeSDzwzhJEh0Bp+FTmifzxBZQBXiIKaAq8BBDQJXgYUoBVYOHKQRUER4mFFBVeJhAQJXh4QwBVYeHMQJmAR5GCJgVeBgiYJbg4T8BswYPp+4GW63WwvLy8hZwLcd5TudvBj3+OFBIeA4PD596nvc1iiIrD21qtdr+ysrKR8cY42itCwUP0Gg0+sC27T5qb2/vMunB/0ipTmZxfN//orW+BCwmrGV6vd63BP9P2j9WxGbxbrd7B3g14fLfwFsROUlzBmNM33XdR6Meuxfp5eg54IYxJvXCx8fHL4F3w36blTdDI4/0WREwMnMBeQ+Qd+YC8h4g78wF5D1A3rEqwBiT6q4ubpRSI+ewuhP0PO/NwcHBExHJZZ8PICI/e73ep7z6zzNPwWP1djhuOp3OfRG5kLROFEXv19fXP49bU6TbYQDa7XZDRF6kUUtEtoFb49YUbh/gOM7YbwqnyG4URQ/PWlQ4ASllNwzDzY2NDX3WwioKmBgeqidgKnioloCp4aE6AmLBQzUExIaH8gtIBA/lFrCTFB7KK2AnDMOrSeGhnAJSg4fyCUgVHsolIHV4KI8AK/BQDgHW4KH4AqzCQwEfiIRheKKUAvjuuu7m2tpakPdMmcYYI1rre0EQ1LPo9w82qyNziMdZ3AAAAABJRU5ErkJggg=="> |
8+
| Services | S3, SSM, Lambda, SNS, SES |
9+
| Integrations | AWS SDK, AWS CLI, GitHub actions, pytest |
10+
| Categories | Serverless, S3 notifications, S3 website, Lambda function URLs, LocalStack developer endpoints, JavaScript, Python | |
11+
| Level | Intermediate |
12+
13+
## Introduction
14+
15+
This is an app to resize images uploaded to S3 in a serverless way.
16+
A simple web fronted using HTML and JavaScript provides a way for users to upload images that are resized and listed.
17+
We use a Lambda to generate S3 pre-signed URLs so the upload form can upload directly to S3 rather than going through the Lambda.
18+
S3 bucket notifications are used to trigger a Python Lambda that runs image resizing.
19+
Another Lambda is used to list all uploaded and resized images, and provide pre-signed URLs for the browser to display them.
20+
We also demonstrate how Lambda failures can submit to SNS, which can then trigger an SES email.
21+
Using the LocalStack internal `/_localstack/aws/ses` endpoint, we can run end-to-end integration tests to verify that emails have been sent correctly.
22+
23+
Here's a short summary of AWS service features we use:
824
* S3 bucket notifications to trigger a Lambda
925
* S3 pre-signed POST
1026
* S3 website
11-
* SSM
12-
* Lambda
1327
* Lambda function URLs
1428
* Lambda SNS on failure destination
1529
* SNS to SES Subscriptions
1630
* SES LocalStack testing endpoint
1731

18-
Moreover, the repo includes a GitHub actions workflow to demonstrate how to run end-to-end tests of your AWS apps using LocalStack in CI.
19-
20-
Here's the app in action:
21-
32+
Here's the web application in action:
2233

2334
https://user-images.githubusercontent.com/3996682/229314248-86122e9e-0150-4292-b889-401e6fb8f398.mp4
2435

36+
Moreover, the repo includes a GitHub actions workflow to demonstrate how to run end-to-end tests of your AWS apps using LocalStack in CI.
37+
The GitHub workflow runs a set of integration tests using pytest.
2538

26-
## Overview
39+
## Architecture overview
2740

2841
![Screenshot at 2023-04-02 01-32-56](https://user-images.githubusercontent.com/3996682/229322761-92f52eec-5bfb-412a-a3cb-8af4ee1fed24.png)
2942

@@ -33,6 +46,7 @@ https://user-images.githubusercontent.com/3996682/229314248-86122e9e-0150-4292-b
3346

3447
Make sure you use the same version as the Python Lambdas to make Pillow work.
3548
If you use pyenv, then first install and activate Python 3.9:
49+
3650
```bash
3751
pyenv install 3.9.16
3852
pyenv global 3.9.16
@@ -59,9 +73,11 @@ Start LocalStack Pro with the appropriate CORS configuration for the S3 Website:
5973
LOCALSTACK_API_KEY=... localstack start
6074
```
6175

62-
## Create the infrastructure manually
76+
## Instructions
6377

6478
You can create the AWS infrastructure on LocalStack by running `bin/deploy.sh`.
79+
Make sure you have Python 3.9 activated before running the script.
80+
6581
Here are instructions to deploy it manually step-by-step.
6682

6783
### Create the buckets
@@ -185,7 +201,7 @@ awslocal s3 sync --delete ./website s3://webapp
185201
awslocal s3 website s3://webapp --index-document index.html
186202
```
187203

188-
## Using the app
204+
### Using the application
189205

190206
Once deployed, visit http://webapp.s3-website.localhost.localstack.cloud:4566
191207

@@ -204,19 +220,21 @@ An email is then sent with the raw failure message.
204220
In a real scenario you'd probably have another lambda sitting here, but it's just for demo purposes.
205221
Since there's no real email server involved, you can use the [SES developer endpoint](https://docs.localstack.cloud/user-guide/aws/ses/) to list messages that were sent via SES:
206222

223+
```bash
207224
curl -s http://localhost.localstack.cloud:4566/_aws/ses
225+
```
208226

209227
An alternative is to use a service like MailHog or smtp4dev, and start LocalStack using `SMTP_HOST=host.docker.internal:1025` pointing to the mock SMTP server.
210228

211-
## Run integration tests
229+
### Run integration tests
212230

213231
Once all resource are created on LocalStack, you can run the automated integration tests.
214232

215233
```bash
216234
pytest tests/
217235
```
218236

219-
## GitHub Action
237+
### GitHub Action
220238

221239
The demo LocalStack in CI, `.github/workflows/integration-test.yml` contains a GitHub Action that starts up LocalStack,
222240
deploys the infrastructure to it, and then runs the integration tests.

0 commit comments

Comments
 (0)