【原创】aws s3 lambda缩略图生成
https://github.com/sagidm/s3-resizer
https://medium.com/swlh/how-to-get-started-with-aws-lambda-9f2ac14d863a
https://heropy.blog/2019/07/21/resizing-images-cloudfrount-lambda/
https://s3.console.aws.amazon.com/s3/home?region=ap-northeast-2
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::n-test-2/*" } ] }
https://ap-northeast-2.console.aws.amazon.com/lambda/home?region=ap-northeast-2#/functions
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": "s3:PutObject", "Resource": "arn:aws:s3:::n-test-2/*" } ] }
https://qzdp929f68.execute-api.ap-northeast-2.amazonaws.com/default/resize-func
<RoutingRules> <RoutingRule> <Condition> <KeyPrefixEquals/> <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals> </Condition> <Redirect> <Protocol>https</Protocol> <HostName>qzdp929f68.execute-api.ap-northeast-2.amazonaws.com</HostName> <ReplaceKeyPrefixWith>default/resize-func?path=</ReplaceKeyPrefixWith> <HttpRedirectCode>307</HttpRedirectCode> </Redirect> </RoutingRule> </RoutingRules>
{ "queryStringParameters": { "path": "300x300/pic2.jpg" } }
http://n-test-2.s3-website.ap-northeast-2.amazonaws.com/300x300/pic2.jpg