Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
- Discribe how to deploy with function URLs
- Remove ListBucket action, the function doesn't need it
  • Loading branch information
martijngastkemper committed Jul 22, 2023
1 parent 27bda35 commit 739b53c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The following environment variables are mandatory:

The following environment variables are optional:

- `IMAGE_ACL`: the ACL applied to generated images. Default is empty. Use `public-read` when this service is deployed as S3 bucket redirect rule. When it's a CloudFront origin, use the default value.
- `IMAGE_ACL`: the ACL applied to generated images. Default is empty. Use `public-read` when this service is deployed as S3 bucket redirect rule. When it's a CloudFront origin, use the default value. Don't forget to allow the Lambda's assume role the action `s3:PutObjectAcl`.
- `QUALITY`: the format option quality setting for all image types. (integer: 1-100)

##### Defining SERVERLESS_ROLE
Expand Down Expand Up @@ -125,11 +125,6 @@ The role must have the following policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "<YOUR-BUCKET-NAME-HERE>"
},
{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject", "s3:PutObjectAcl"],
Expand Down
42 changes: 42 additions & 0 deletions serverless.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
service: ##SERVICE_NAME##

configValidationMode: error

package:
patterns:
- "!**"
- "node_modules/**"
- "index.js"
- "util/**"

parameters:
default:
bucket: ##BUCKET##
image_quality: 80

provider:
name: aws
iam:
role:
statements:
- Effect: "Allow"
Action:
- "s3:GetObject"
- "s3:PutObject"
Resource:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- ${param:bucket}
- "/*"
runtime: nodejs18.x
environment:
BUCKET: ${param:bucket}
IMAGE_QUALITY: ${param:image_quality}

functions:
main:
handler: index.handler
description: "Scale images at runtime."
url: true
logRetentionInDays: 14

0 comments on commit 739b53c

Please sign in to comment.