- Access the server at
https://your.domain.com/images/some_file.jpg?w=1280&h=960
. - Use
Lambda@Edge
to transform the URL tohttps://your.domain.com/images/w=1280&h=960&quality=50&ext=webp&fit=inside/some_file.jpg
. - Access S3 using the transformed URL.
- If the file exists in S3, proceed to step 6; if it doesn't exist, perform step 5.
- Convert the image at the original access location,
images/some_file.jpg
, and save it asimages/w=1280&h=960&quality=50&ext=webp&fit=inside/some_file.jpg
. - Return either the retrieved file or the converted file.
- create
infra/params.ts
from example
$ cd infra
$ cp paramsExample.ts params.ts
-
prepare your domain in
Route53
-
get Certificate of your domain in
ACM
-
edit
params.ts
and set parameters -
deploy via CDK
# in infrastructure directory
$ cdk ls
zenn-cf-resize-node-lambda
zenn-cf-resize-cloudfront
$ cdk deploy zenn-cf-resize-cloudfront
- access your file