Skip to content

Commit 7bb5d5b

Browse files
simonkrolMichael Lam (MakerVille)
authored and
Michael Lam (MakerVille)
committed
Update to version 7.0.0 (aws-solutions#586)
1 parent 904ee7e commit 7bb5d5b

File tree

96 files changed

+5830
-899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5830
-899
lines changed

CHANGELOG.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,51 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [7.0.0] - 2025-01-27
9+
10+
### Changed
11+
12+
- Location of API Gateway infrastructure resources
13+
- **Breaking** New condition on API gateway will cause a delete/create of ApiGateway::Deployment on stack update
14+
- **Breaking:** Exception thrown on invalid resize parameters [#463](https://github.com/aws-solutions/serverless-image-handler/pull/463)
15+
- Code formatting to align with ESLint rules
16+
- **Breaking** Reduced passthrough of errors from external APIs to response body. Errors will still be logged.
17+
- Modified CloudFront logging bucket to have versioning enabled by default
18+
- CloudFront behaviour to redirect http requests to https rather than throwing forbidden error
19+
- Set-Cookie was added to list of deny-listed response headers
20+
- Name of solution from Serverless Image Handler on AWS to Dynamic Image Transformation for Amazon CloudFront.
21+
22+
### Added
23+
24+
- Ability to enable origin shield through a deployment parameter
25+
- Ability to deploy solution without creating a CloudFront distribution
26+
- CloudFront function to normalize accept headers when AutoWebP is enabled
27+
- Alternative infrastructure using S3 Object Lambda to overcome 6 MB response size limit
28+
- Query param named expires which can be used to define when a generated image should no longer be accessible
29+
- Ability to include smart_crop as a filter for Thumbor style requests, taking advantage of AWS Rekognition face cropping
30+
- Ability to set CloudWatch log retention period to Infinite
31+
- Ability to specify Sharp input image size limit [#465](https://github.com/aws-solutions/serverless-image-handler/issues/465) [#476](https://github.com/aws-solutions/serverless-image-handler/pull/476)
32+
- Query parameter based image editing [#184](https://github.com/aws-solutions/serverless-image-handler/issues/184)
33+
- Query parameter normalization to improve cache hit rate
34+
- CloudWatch dashboard to improve Solution observability
35+
- Additional anonymized metrics to help understand how the solution is being used, identify areas of improvement, and drive future roadmap decisions.
36+
37+
### Removed
38+
39+
- Accept header being used in cache policy when AutoWebP is disabled
40+
41+
### Fixed
42+
43+
- Broken URLs in Signature and Fallback Image template parameters
44+
845
## [6.3.3] - 2024-12-27
946

1047
### Fixed
48+
1149
- Overlays not checking for valid S3 buckets
1250
- Failures when updating deployments created in version 6.1.0 and prior [#559](https://github.com/aws-solutions/serverless-image-handler/issues/559)
1351

14-
### Security
52+
### Security
1553

1654
- Added allowlist on sharp operations. [Info](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/create-and-use-image-requests.html#restricted-operations)
1755
- Added deny list on custom headers for base64 encoded requests. [Info](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/create-and-use-image-requests.html#include-custom-response-headers)
@@ -20,8 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2058
## [6.3.2] - 2024-11-22
2159

2260
### Fixed
23-
- Upgrade cross-spawn to v7.0.6 for vulnerability [CVE-2024-9506](https://github.com/advisories/GHSA-5j4c-8p2g-v4jx)
2461

62+
- Upgrade cross-spawn to v7.0.6 for vulnerability [CVE-2024-9506](https://github.com/advisories/GHSA-5j4c-8p2g-v4jx)
2563

2664
## [6.3.1] - 2024-10-02
2765

NOTICE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Serverless Image Handler
1+
Dynamic Image Transformation for Amazon CloudFront
22

33
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
Licensed under the Apache License Version 2.0 (the "License"). You may not use this file except
@@ -24,6 +24,7 @@ This software includes third party software subject to the following copyrights:
2424
@aws-solutions-constructs/aws-cloudfront-s3 under the Apache License 2.0
2525
@aws-solutions-constructs/core under the Apache License 2.0
2626
@popperjs/core under the Massachusetts Institute of Technology (MIT) license
27+
@types/aws-lambda under the Massachusetts Institute of Technology (MIT) license
2728
@types/color under the Massachusetts Institute of Technology (MIT) license
2829
@types/color-name under the Massachusetts Institute of Technology (MIT) license
2930
@types/jest under the Massachusetts Institute of Technology (MIT) license
@@ -55,6 +56,7 @@ ts-jest under the Massachusetts Institute of Technology (MIT) license
5556
ts-node under the Massachusetts Institute of Technology (MIT) license
5657
typescript under the Apache License 2.0
5758
uuid under the Massachusetts Institute of Technology (MIT) license
59+
dayjs under the Massachusetts Institute of Technology (MIT) license
5860
@aws-sdk/client-cloudwatch under the Apache License 2.0
5961
@aws-sdk/client-cloudwatch-logs under the Apache License 2.0
6062
@aws-sdk/client-sqs under the Apache License 2.0

README.md

Lines changed: 14 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
**[Serverless Image Handler](https://aws.amazon.com/solutions/implementations/serverless-image-handler/)** | **[🚧 Feature request](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)** | **[🐛 Bug Report](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=bug&template=bug_report.md&title=)** | **[❓ General Question](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=question&template=general_question.md&title=)**
1+
**[Dynamic Image Transformation for Amazon CloudFront](https://aws.amazon.com/solutions/implementations/dynamic-image-transformation-for-amazon-cloudfront/)** | **[🚧 Feature request](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)** | **[🐛 Bug Report](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=bug&template=bug_report.md&title=)** | **[❓ General Question](https://github.com/aws-solutions/serverless-image-handler/issues/new?assignees=&labels=question&template=general_question.md&title=)**
22

3-
**Note**: If you want to use the solution without building from source, navigate to [Solution Landing Page](https://aws.amazon.com/solutions/implementations/serverless-image-handler/).
3+
**Note**: If you want to use the solution without building from source, navigate to [Solution Landing Page](https://aws.amazon.com/solutions/implementations/dynamic-image-transformation-for-amazon-cloudfront/).
44

55
## Example request
66

@@ -80,17 +80,25 @@ console.log(`https://d1fcriiw4qut8m.cloudfront.net/${btoa(imageRequest)}`);
8080

8181
# Solution Overview
8282

83-
The Serverless Image Handler solution helps to embed images on websites and mobile applications to drive user engagement. It uses [Sharp](https://sharp.pixelplumbing.com/en/stable/) to provide high-speed image processing without sacrificing image quality. To minimize costs of image optimization, manipulation, and processing, this solution automates version control and provides flexible storage and compute options for file reprocessing.
83+
The Dynamic Image Transformation for Amazon CloudFront solution helps to embed images on websites and mobile applications to drive user engagement. It uses [Sharp](https://sharp.pixelplumbing.com/en/stable/) to provide high-speed image processing without sacrificing image quality. To minimize costs of image optimization, manipulation, and processing, this solution automates version control and provides flexible storage and compute options for file reprocessing.
8484

8585
This solution automatically deploys and configures a serverless architecture optimized for dynamic image manipulation. Images can be rendered and returned spontaneously. For example, an image can be resized based on different screen sizes by adding code on a website that leverages this solution to resize the image before being sent to the screen using the image. It uses [Amazon CloudFront](https://aws.amazon.com/cloudfront) for global content delivery and [Amazon Simple Storage Service](https://aws.amazon.com/s3) (Amazon S3) for reliable and durable cloud storage.
8686

87-
For more information and a detailed deployment guide, visit the [Serverless Image Handler](https://aws.amazon.com/solutions/implementations/serverless-image-handler/) solution page.
87+
For more information and a detailed deployment guide, visit the [Dynamic Image Transformation for Amazon CloudFront](https://aws.amazon.com/solutions/implementations/dynamic-image-transformation-for-amazon-cloudfront/) solution page.
8888

8989
# Architecture Diagram
9090

91-
![Architecture Diagram](./architecture.png)
91+
Dynamic Image Transformation for Amazon CloudFront supports two architectures, one using an Amazon API Gateway REST API, and another using S3 Object Lambda. The Amazon API Gateway REST API architecture maintains the structure used in v6.3.3 and below of the Dynamic Image Transformation for Amazon CloudFront. The S3 Object Lambda architecture maintains very similar functionality, while also allowing for images larger than 6 MB to be returned. For more information, refer to the [Architecture Overview](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/architecture-overview.html) in the implementation guide.
9292

93-
The AWS CloudFormation template deploys an Amazon CloudFront distribution, Amazon API Gateway REST API, and an AWS Lambda function. Amazon CloudFront provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery. The Amazon API Gateway provides endpoint resources and triggers the AWS Lambda function. The AWS Lambda function retrieves the image from the customer's Amazon Simple Storage Service (Amazon S3) bucket and uses Sharp to return a modified version of the image to the API Gateway. Additionally, the solution generates a CloudFront domain name that provides cached access to the image handler API.
93+
The AWS CloudFormation template deploys an Amazon CloudFront distribution, Amazon API Gateway REST API/S3 Object Lambda, and an AWS Lambda function. Amazon CloudFront provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery. The Amazon API Gateway/S3 Object Lambda provides endpoint resources and triggers the AWS Lambda function. The AWS Lambda function retrieves the image from the customer's Amazon Simple Storage Service (Amazon S3) bucket and uses Sharp to return a modified version of the image. Additionally, the solution generates a CloudFront domain name that provides cached access to the image handler API. There is limited use of CloudFront functions for consistency and cache hit rate purposes.
94+
95+
## Default Architecture
96+
97+
![Architecture Diagram (Default Architecture)](./default_architecture.png)
98+
99+
## S3 Object Lambda Architecture
100+
101+
![Architecture Diagram (S3 Object Lambda Architecture)](./object_lambda_architecture.png)
94102

95103
# AWS CDK and Solutions Constructs
96104

@@ -101,77 +109,6 @@ The AWS CloudFormation template deploys an Amazon CloudFront distribution, Amazo
101109

102110
In addition to the AWS Solutions Constructs, the solution uses AWS CDK directly to create infrastructure resources.
103111

104-
# Customizing the Solution
105-
106-
## Prerequisites for Customization
107-
108-
- [AWS Command Line Interface](https://aws.amazon.com/cli/)
109-
- Node.js 20.x or later
110-
111-
### 1. Clone the repository
112-
113-
```bash
114-
git clone https://github.com/aws-solutions/serverless-image-handler.git
115-
cd serverless-image-handler
116-
export MAIN_DIRECTORY=$PWD
117-
```
118-
119-
### 2. Unit Test
120-
121-
After making changes, run unit tests to make sure added customization passes the tests:
122-
123-
```bash
124-
cd $MAIN_DIRECTORY/deployment
125-
chmod +x run-unit-tests.sh && ./run-unit-tests.sh
126-
```
127-
128-
### 3. Build and Deploy
129-
130-
```bash
131-
cd $MAIN_DIRECTORY/source/constructs
132-
npm run clean:install
133-
overrideWarningsEnabled=false npx cdk bootstrap
134-
overrideWarningsEnabled=false npx cdk deploy\
135-
--parameters DeployDemoUIParameter=Yes\
136-
--parameters SourceBucketsParameter=static.mirrorweare.com,static.makealive.com,makerville.hk,www-dev.makerville.hk,makealive-resources-dev,makerville-mofc-dev,prerender.makerville.hk
137-
```
138-
139-
_Note:_
140-
141-
- **MY_BUCKET**: name of an existing bucket in your account
142-
- **PROFILE_NAME**: name of an AWS CLI profile that has appropriate credentials for deploying in your preferred region
143-
144-
# Collection of operational metrics
145-
146-
This solution collects anonymous operational metrics to help AWS improve the quality and features of the solution. For more information, including how to disable this capability, please see the [implementation guide](https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/op-metrics.html).
147-
148-
# External Contributors
149-
150-
- [@leviwilson](https://github.com/leviwilson) for [#117](https://github.com/aws-solutions/serverless-image-handler/pull/117)
151-
- [@rpong](https://github.com/rpong) for [#130](https://github.com/aws-solutions/serverless-image-handler/pull/130)
152-
- [@harriswong](https://github.com/harriswong) for [#138](https://github.com/aws-solutions/serverless-image-handler/pull/138)
153-
- [@ganey](https://github.com/ganey) for [#139](https://github.com/aws-solutions/serverless-image-handler/pull/139)
154-
- [@browniebroke](https://github.com/browniebroke) for [#151](https://github.com/aws-solutions/serverless-image-handler/pull/151), [#152](https://github.com/aws-solutions/serverless-image-handler/pull/152)
155-
- [@john-shaffer](https://github.com/john-shaffer) for [#158](https://github.com/aws-solutions/serverless-image-handler/pull/158)
156-
- [@toredash](https://github.com/toredash) for [#174](https://github.com/aws-solutions/serverless-image-handler/pull/174), [#195](https://github.com/aws-solutions/serverless-image-handler/pull/195)
157-
- [@lith-imad](https://github.com/lith-imad) for [#194](https://github.com/aws-solutions/serverless-image-handler/pull/194)
158-
- [@pch](https://github.com/pch) for [#227](https://github.com/aws-solutions/serverless-image-handler/pull/227)
159-
- [@atrope](https://github.com/atrope) for [#201](https://github.com/aws-solutions/serverless-image-handler/pull/201), [#202](https://github.com/aws-solutions/serverless-image-handler/pull/202)
160-
- [@bretto36](https://github.com/bretto36) for [#182](https://github.com/aws-solutions/serverless-image-handler/pull/182)
161-
- [@makoncline](https://github.com/makoncline) for [#255](https://github.com/aws-solutions/serverless-image-handler/pull/255)
162-
- [@frankenbubble](https://github.com/frankenbubble) for [#302](https://github.com/aws-solutions/serverless-image-handler/pull/302)
163-
- [@guidev](https://github.com/guidev) for [#309](https://github.com/aws-solutions/serverless-image-handler/pull/309)
164-
- [@njtmead](https://github.com/njtmead) for [#276](https://github.com/aws-solutions/serverless-image-handler/pull/276)
165-
- [@StaymanHou](https://github.com/StaymanHou) for [#320](https://github.com/aws-solutions/serverless-image-handler/pull/320)
166-
- [@alenpaulvarghese](https://github.com/alenpaulvarghese) for [#392](https://github.com/aws-solutions/serverless-image-handler/pull/392)
167-
- [@Fjool](https://github.com/Fjool) for [#489](https://github.com/aws-solutions/serverless-image-handler/pull/489)
168-
- [@fvsnippets](https://github.com/fvsnippets) for [#373](https://github.com/aws-solutions/serverless-image-handler/pull/373), [#380](https://github.com/aws-solutions/serverless-image-handler/pull/380)
169-
- [@ccchapman](https://github.com/ccchapman) for [#490](https://github.com/aws-solutions/serverless-image-handler/pull/490)
170-
- [@bennet-esyoil](https://github.com/bennet-esyoil) for [#521](https://github.com/aws-solutions/serverless-image-handler/pull/521)
171-
- [@vaniyokk](https://github.com/vaniyokk) for [#511](https://github.com/aws-solutions/serverless-image-handler/pull/511)
172-
- [@nicolasbuch](https://github.com/nicolasbuch) for [#569](https://github.com/aws-solutions/serverless-image-handler/pull/569)
173-
- [@mrnonz](https://github.com/mrnonz) for [#567](https://github.com/aws-solutions/serverless-image-handler/pull/567)
174-
175112
# License
176113

177114
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.3
1+
7.0.0

default_architecture.png

135 KB
Loading

deployment/cdk-solution-helper/asset-packager/asset-packager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import AdmZip from "adm-zip";
1212
* on solution internal pipelines
1313
*/
1414
export class CDKAssetPackager {
15-
constructor(private readonly assetFolderPath: string) {}
15+
constructor(private readonly assetFolderPath: string) { }
1616

1717
/**
1818
* @description get cdk asset paths

object_lambda_architecture.png

127 KB
Loading

source/.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"jsdoc/require-returns-type": ["off"],
4141
"jsdoc/newline-after-description": ["off"],
4242

43-
"import/no-unresolved": 1 // warn only on Unable to resolve path import/no-unresolved
43+
"import/no-unresolved": 1, // warn only on Unable to resolve path import/no-unresolved
44+
"dot-notation": "off"
4445
}
4546
}

source/constructs/bin/constructs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (DIST_OUTPUT_BUCKET && SOLUTION_NAME && VERSION)
1919
});
2020

2121
const app = new App();
22-
const solutionDisplayName = "Serverless Image Handler";
22+
const solutionDisplayName = "Dynamic Image Transformation for Amazon CloudFront";
2323
const solutionVersion = VERSION ?? app.node.tryGetContext("solutionVersion");
2424
const description = `(${app.node.tryGetContext("solutionId")}) - ${solutionDisplayName}. Version ${solutionVersion}`;
2525
// eslint-disable-next-line no-new

source/constructs/cdk.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"app": "npx ts-node --prefer-ts-exts bin/constructs.ts",
33
"context": {
44
"solutionId": "SO0023",
5-
"solutionVersion": "custom-v6.3.3",
6-
"solutionName": "serverless-image-handler"
5+
"solutionVersion": "custom-v7.0.0",
6+
"solutionName": "dynamic-image-transformation-for-amazon-cloudfront"
77
}
88
}

0 commit comments

Comments
 (0)