├── .gitignore ├── README.md ├── handler.js ├── package-lock.json ├── package.json ├── postman_collection └── lambda-image-resize.postman_collection.json └── serverless.yml /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,code,serverless 3 | # Edit at https://www.gitignore.io/?templates=node,code,serverless 4 | 5 | ### Code ### 6 | .vscode/* 7 | !.vscode/settings.json 8 | !.vscode/tasks.json 9 | !.vscode/launch.json 10 | !.vscode/extensions.json 11 | 12 | ### Node ### 13 | # Logs 14 | logs 15 | *.log 16 | npm-debug.log* 17 | yarn-debug.log* 18 | yarn-error.log* 19 | lerna-debug.log* 20 | 21 | # Diagnostic reports (https://nodejs.org/api/report.html) 22 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 23 | 24 | # Runtime data 25 | pids 26 | *.pid 27 | *.seed 28 | *.pid.lock 29 | 30 | # Directory for instrumented libs generated by jscoverage/JSCover 31 | lib-cov 32 | 33 | # Coverage directory used by tools like istanbul 34 | coverage 35 | 36 | # nyc test coverage 37 | .nyc_output 38 | 39 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 40 | .grunt 41 | 42 | # Bower dependency directory (https://bower.io/) 43 | bower_components 44 | 45 | # node-waf configuration 46 | .lock-wscript 47 | 48 | # Compiled binary addons (https://nodejs.org/api/addons.html) 49 | build/Release 50 | 51 | # Dependency directories 52 | node_modules/ 53 | jspm_packages/ 54 | 55 | # TypeScript v1 declaration files 56 | typings/ 57 | 58 | # Optional npm cache directory 59 | .npm 60 | 61 | # Optional eslint cache 62 | .eslintcache 63 | 64 | # Optional REPL history 65 | .node_repl_history 66 | 67 | # Output of 'npm pack' 68 | *.tgz 69 | 70 | # Yarn Integrity file 71 | .yarn-integrity 72 | 73 | # dotenv environment variables file 74 | .env 75 | .env.test 76 | 77 | # parcel-bundler cache (https://parceljs.org/) 78 | .cache 79 | 80 | # next.js build output 81 | .next 82 | 83 | # nuxt.js build output 84 | .nuxt 85 | 86 | # vuepress build output 87 | .vuepress/dist 88 | 89 | # Serverless directories 90 | .serverless/ 91 | 92 | # FuseBox cache 93 | .fusebox/ 94 | 95 | # DynamoDB Local files 96 | .dynamodb/ 97 | 98 | ### Serverless ### 99 | # Ignore build directory 100 | .serverless 101 | 102 | # End of https://www.gitignore.io/api/node,code,serverless 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # serverless-node-simple-image-resize 2 | 3 | Simple AWS lambda serverless function for resizing images. The function resizes the image based on input parameters for size and upload the image on AWS S3. 4 | 5 | ## Setup 6 | Run the following commands 7 | ```sh 8 | $ npm install -g serverless # Install serverless globally 9 | $ serverless config credentials --provider aws --key --secret # Setting up default aws credentials 10 | $ cd aws-serverless-image-resize 11 | $ npm install # Installing dependency 12 | ``` 13 | 14 | ## Deployment 15 | ```sh 16 | $ serverless deploy # Deploying serverless function to aws 17 | ``` 18 | 19 | By this command `serverless deploy` you should be able to see the lambda function in your aws lambda dashboard and it should have returned an endpoint and api_key in your terminal keep these for now. 20 | 21 | Setup the following variables into your aws lambda function 22 | - ACCESS_KEY_ID (AWS account access key) 23 | - SECRET_ACCESS_KEY (AWS account secret key) 24 | - BUCKET (S3 bucket name where resized images will get uploaded) 25 | 26 | ## Running 27 | 28 | Run ```export MY_API_KEY=``` 29 | 30 | Make a GET API call with to the endpoint and send x-api-key into headers with the api_key value returned after deploy command. The API supports the following query parameters 31 | - imageUrl (A public URL of the image you want to resize) 32 | - width or height (One of the following parameter for desired image size) 33 | 34 | ```?imageUrl=https://s3.amazonaws.com/towlot-portal-images/1551975541895.jpeg&height=200``` 35 | 36 | The API call will return the image URL that has been added to your S3 account. 37 | 38 | ## Running by postman collection 39 | 40 | - Import the postman collection and set the endpoint and x-api-key and make a hit. 41 | 42 | ## Contributors 43 | 44 | [Sparsh Pipley](https://in.linkedin.com/in/sparsh-pipley-6ab0b1a4/) 45 | 46 | ## License 47 | 48 | Built under [MIT](http://www.opensource.org/licenses/mit-license.php) license. 49 | 50 | -------------------------------------------------------------------------------- /handler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let Jimp = require('jimp'); 4 | let AWS = require('aws-sdk'); 5 | let mime = require('mime-types'); 6 | 7 | const accessKeyId = process.env.ACCESS_KEY_ID; 8 | const secretAccessKey = process.env.SECRET_ACCESS_KEY; 9 | const bucket = process.env.BUCKET; 10 | 11 | AWS.config.update({ 12 | accessKeyId: accessKeyId, 13 | secretAccessKey: secretAccessKey 14 | }); 15 | 16 | let s3 = new AWS.S3(); 17 | 18 | async function uploadToS3(buffer, filename) { 19 | let params = { 20 | Bucket: bucket, 21 | Key: filename, 22 | Body: buffer, 23 | ACL: 'public-read' 24 | }; 25 | 26 | return await new Promise((resolve, reject) => { 27 | s3.putObject(params, function (err, pres) { 28 | if (err) { 29 | console.log('err', err) 30 | reject(err); 31 | } else { 32 | resolve('Image uploaded sucessfully'); 33 | } 34 | }); 35 | }); 36 | } 37 | 38 | module.exports.imageResize = async (event) => { 39 | try { 40 | let request = event; 41 | let imageUrl = request.queryStringParameters.imageUrl; 42 | 43 | if (request.height && request.width) { 44 | return { 45 | statusCode: 400, 46 | body: JSON.stringify({ 47 | message: 'Both height and width should not be preset in request' 48 | }), 49 | }; 50 | } 51 | 52 | if (!imageUrl) { 53 | return { 54 | statusCode: 400, 55 | body: JSON.stringify({ 56 | message: 'imageUrl must be present' 57 | }), 58 | }; 59 | } 60 | 61 | let height = parseInt(request.queryStringParameters.height) || Jimp.AUTO; 62 | let width = parseInt(request.queryStringParameters.width) || Jimp.AUTO; 63 | let image = await Jimp.read(imageUrl); 64 | let mimeType = image.getMIME(); 65 | let ext = mime.extension(mimeType); 66 | 67 | let fileName = `${new Date().getTime().toString()}.${ext}`; 68 | 69 | let buffer = await image.resize(height, width).getBufferAsync(mimeType); 70 | let s3Result = await uploadToS3(buffer, fileName); 71 | 72 | if (s3Result !== 'Image uploaded sucessfully') { 73 | return { 74 | statusCode: 500, 75 | body: JSON.stringify({ 76 | message: 'Issue while upload image to S3' 77 | }), 78 | }; 79 | } else { 80 | let imageUrl = `https://${bucket}.s3.amazonaws.com/${fileName}`; 81 | return { 82 | statusCode: 200, 83 | body: JSON.stringify({ 84 | message: imageUrl 85 | }), 86 | }; 87 | } 88 | } catch (err) { 89 | console.log(err); 90 | return { 91 | statusCode: 500, 92 | body: JSON.stringify({ 93 | message: 'Internal server error' 94 | }), 95 | }; 96 | } 97 | }; 98 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lambda-email", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@babel/polyfill": { 8 | "version": "7.4.4", 9 | "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz", 10 | "integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==", 11 | "requires": { 12 | "core-js": "^2.6.5", 13 | "regenerator-runtime": "^0.13.2" 14 | } 15 | }, 16 | "@jimp/bmp": { 17 | "version": "0.6.4", 18 | "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.6.4.tgz", 19 | "integrity": "sha512-dhKM7Cjw4XoOefx3/we2+vWyTP6hQPpM7mEsziGjtsrK2f/e3/+hhHbEsQNgO9BOA1FPJRXAOiYHts9IlMH1mg==", 20 | "requires": { 21 | "@jimp/utils": "^0.6.4", 22 | "bmp-js": "^0.1.0", 23 | "core-js": "^2.5.7" 24 | } 25 | }, 26 | "@jimp/core": { 27 | "version": "0.6.4", 28 | "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.6.4.tgz", 29 | "integrity": "sha512-nyiAXI8/uU54fGO53KrRB8pdn1s+IODZ+rj0jG2owsNJlTlagFrsZAy8IVTUCOiiXjh9TbwFo7D5XMrmi4KUww==", 30 | "requires": { 31 | "@jimp/utils": "^0.6.4", 32 | "any-base": "^1.1.0", 33 | "buffer": "^5.2.0", 34 | "core-js": "^2.5.7", 35 | "exif-parser": "^0.1.12", 36 | "file-type": "^9.0.0", 37 | "load-bmfont": "^1.3.1", 38 | "mkdirp": "0.5.1", 39 | "phin": "^2.9.1", 40 | "pixelmatch": "^4.0.2", 41 | "tinycolor2": "^1.4.1" 42 | } 43 | }, 44 | "@jimp/custom": { 45 | "version": "0.6.4", 46 | "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.6.4.tgz", 47 | "integrity": "sha512-sdBHrBoVr1+PFx4dlUAgXvvu4dG0esQobhg7qhpSLRje1ScavIgE2iXdJKpycgzrqwAOL8vW4/E5w2/rONlaoQ==", 48 | "requires": { 49 | "@jimp/core": "^0.6.4", 50 | "core-js": "^2.5.7" 51 | } 52 | }, 53 | "@jimp/gif": { 54 | "version": "0.6.4", 55 | "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.6.4.tgz", 56 | "integrity": "sha512-14mLoyG0UrYJsGNRoXBFvSJdFtBD0BSBwQ1zCNeW+HpQqdl+Kh5E1Pz4nqT2KNylJe1jypyR51Q2yndgcfGVyg==", 57 | "requires": { 58 | "@jimp/utils": "^0.6.4", 59 | "core-js": "^2.5.7", 60 | "omggif": "^1.0.9" 61 | } 62 | }, 63 | "@jimp/jpeg": { 64 | "version": "0.6.4", 65 | "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.6.4.tgz", 66 | "integrity": "sha512-NrFla9fZC/Bhw1Aa9vJ6cBOqpB5ylEPb9jD+yZ0fzcAw5HwILguS//oXv9EWLApIY1XsOMFFe0XWpY653rv8hw==", 67 | "requires": { 68 | "@jimp/utils": "^0.6.4", 69 | "core-js": "^2.5.7", 70 | "jpeg-js": "^0.3.4" 71 | } 72 | }, 73 | "@jimp/plugin-blit": { 74 | "version": "0.6.4", 75 | "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.6.4.tgz", 76 | "integrity": "sha512-suVznd4XozkQIuECX0u8kMl+cAQpZN3WcbWXUcJaVxRi+VBvHIetG1Qs5qGLzuEg9627+kE7ppv0UgZ5mkE6lg==", 77 | "requires": { 78 | "@jimp/utils": "^0.6.4", 79 | "core-js": "^2.5.7" 80 | } 81 | }, 82 | "@jimp/plugin-blur": { 83 | "version": "0.6.4", 84 | "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.6.4.tgz", 85 | "integrity": "sha512-M2fDMYUUtEKVNnCJZk5J0KSMzzISobmWfnG88RdHXJCkOn98kdawQFwTsYOfJJfCM8jWfhIxwZLFhC/2lkTN2w==", 86 | "requires": { 87 | "@jimp/utils": "^0.6.4", 88 | "core-js": "^2.5.7" 89 | } 90 | }, 91 | "@jimp/plugin-color": { 92 | "version": "0.6.4", 93 | "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.6.4.tgz", 94 | "integrity": "sha512-6Nfr2l9KSb6zH2fij8G6fQOw85TTkyRaBlqMvDmsQp/I1IlaDbXzA2C2Eh9jkQYZQDPu61B1MkmlEhJp/TUx6Q==", 95 | "requires": { 96 | "@jimp/utils": "^0.6.4", 97 | "core-js": "^2.5.7", 98 | "tinycolor2": "^1.4.1" 99 | } 100 | }, 101 | "@jimp/plugin-contain": { 102 | "version": "0.6.4", 103 | "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.6.4.tgz", 104 | "integrity": "sha512-qI1MxU1noS6NbEPu/bDDeP405aMviuIsfpOz8J3En8IwIwrJV22qt6QIHmF+eyng8CYgivwIPjEPzFzLR566Nw==", 105 | "requires": { 106 | "@jimp/utils": "^0.6.4", 107 | "core-js": "^2.5.7" 108 | } 109 | }, 110 | "@jimp/plugin-cover": { 111 | "version": "0.6.4", 112 | "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.6.4.tgz", 113 | "integrity": "sha512-z6eafPonj3LJY8cTEfRkXmOfCDi1+f0tbYaNvmiu+OrWJ3Ojw2hMt+BVVvJ8pKe1dWIFkCjxOjyjZWj1gEkaLw==", 114 | "requires": { 115 | "@jimp/utils": "^0.6.4", 116 | "core-js": "^2.5.7" 117 | } 118 | }, 119 | "@jimp/plugin-crop": { 120 | "version": "0.6.4", 121 | "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.6.4.tgz", 122 | "integrity": "sha512-w9TR+pn+GeWbznscGe2HRkPxInge0whAF3TLPWhPwBVjZChTT8dSDXsUpUlxQqvI4SfzuKp8z3/0SBqYDCzxxA==", 123 | "requires": { 124 | "@jimp/utils": "^0.6.4", 125 | "core-js": "^2.5.7" 126 | } 127 | }, 128 | "@jimp/plugin-displace": { 129 | "version": "0.6.4", 130 | "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.6.4.tgz", 131 | "integrity": "sha512-MEvtBXOAio/3iGJkKBrTtFs3Q38ez2Wy/wTD0Ruas+L8fjJR7l4mDgV+zjRr57CqB5mpY+L48VEoa2/gNXh9cg==", 132 | "requires": { 133 | "@jimp/utils": "^0.6.4", 134 | "core-js": "^2.5.7" 135 | } 136 | }, 137 | "@jimp/plugin-dither": { 138 | "version": "0.6.4", 139 | "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.6.4.tgz", 140 | "integrity": "sha512-w+AGLcIMUeJZ4CI0FvFomahgKLcW+ICsLidUNOqyLzceluPAfug4X7vDhQ41pNkzKg0M1+Q1j0aWV8bdyF+LhA==", 141 | "requires": { 142 | "@jimp/utils": "^0.6.4", 143 | "core-js": "^2.5.7" 144 | } 145 | }, 146 | "@jimp/plugin-flip": { 147 | "version": "0.6.4", 148 | "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.6.4.tgz", 149 | "integrity": "sha512-ukINMegMUM9KYjyDCiyYKYdSsbhNRLHDwOJN0xVRalmOKqNaZmjNbiMbaVxKlYt6sHW76RhSMOekw9f6GQB9tQ==", 150 | "requires": { 151 | "@jimp/utils": "^0.6.4", 152 | "core-js": "^2.5.7" 153 | } 154 | }, 155 | "@jimp/plugin-gaussian": { 156 | "version": "0.6.4", 157 | "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.6.4.tgz", 158 | "integrity": "sha512-C1P6ohzIddpNb7CX5X+ygbp+ow8Fpt64ZLoIgdjYPs/42HxKluvY62fVfMhY6m5zUGKIMbg0uYeAtz/9LRJPyw==", 159 | "requires": { 160 | "@jimp/utils": "^0.6.4", 161 | "core-js": "^2.5.7" 162 | } 163 | }, 164 | "@jimp/plugin-invert": { 165 | "version": "0.6.4", 166 | "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.6.4.tgz", 167 | "integrity": "sha512-sleGz1jXaNEsP/5Ayqw8oez/6KesWcyCqovIuK4Z4kDmMc2ncuhsXIJQXDWtIF4tTQVzNEgrxUDNA4bi9xpCUA==", 168 | "requires": { 169 | "@jimp/utils": "^0.6.4", 170 | "core-js": "^2.5.7" 171 | } 172 | }, 173 | "@jimp/plugin-mask": { 174 | "version": "0.6.4", 175 | "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.6.4.tgz", 176 | "integrity": "sha512-3D4FbRxnpO9nzwa6cF8AImgO1aVReYbfRRO4I4bku4/iZ+kuU3fBLV+SRhB4c7di3ejG5u+rGsIfaNc94iYYvw==", 177 | "requires": { 178 | "@jimp/utils": "^0.6.4", 179 | "core-js": "^2.5.7" 180 | } 181 | }, 182 | "@jimp/plugin-normalize": { 183 | "version": "0.6.4", 184 | "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.6.4.tgz", 185 | "integrity": "sha512-nOFMwOaVkOKArHkD/T6/1HKAPj3jlW6l0JduVDn1A5eIPCtlnyhlE9zdjgi5Q9IBR/gRjwW6tTzBKuJenS51kg==", 186 | "requires": { 187 | "@jimp/utils": "^0.6.4", 188 | "core-js": "^2.5.7" 189 | } 190 | }, 191 | "@jimp/plugin-print": { 192 | "version": "0.6.4", 193 | "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.6.4.tgz", 194 | "integrity": "sha512-3z5DLVCKg0NfZhHATEaYH/4XanIboPP1pOUoxIUeF++qOnGiGgH2giFJlRprHmx2l3E3DukR1v8pt54PGvfrFw==", 195 | "requires": { 196 | "@jimp/utils": "^0.6.4", 197 | "core-js": "^2.5.7", 198 | "load-bmfont": "^1.4.0" 199 | } 200 | }, 201 | "@jimp/plugin-resize": { 202 | "version": "0.6.4", 203 | "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.6.4.tgz", 204 | "integrity": "sha512-fk2+KheUNClrOWj6aDNWj1r4byVQb6Qxy4aT1UHX5GXPHDA+nhlej7ghaYdzeWZYodeM3lpasYtByu1XE2qScQ==", 205 | "requires": { 206 | "@jimp/utils": "^0.6.4", 207 | "core-js": "^2.5.7" 208 | } 209 | }, 210 | "@jimp/plugin-rotate": { 211 | "version": "0.6.4", 212 | "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.6.4.tgz", 213 | "integrity": "sha512-44VgV5D4xQIYInJAVevdW9J3SOhGKyz0OEr2ciA8Q3ktonKx0O5Q1g2kbruiqxFSkK/u2CKPLeKXZzYCFrmJGQ==", 214 | "requires": { 215 | "@jimp/utils": "^0.6.4", 216 | "core-js": "^2.5.7" 217 | } 218 | }, 219 | "@jimp/plugin-scale": { 220 | "version": "0.6.4", 221 | "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.6.4.tgz", 222 | "integrity": "sha512-RAQRaDiCHmEz+A8QS5d/Z38EnlNsQizz3Mu3NsjA8uFtJsv1yMKWXZSQuzniofZw8tlMV6oI3VdM0eQVE07/5w==", 223 | "requires": { 224 | "@jimp/utils": "^0.6.4", 225 | "core-js": "^2.5.7" 226 | } 227 | }, 228 | "@jimp/plugins": { 229 | "version": "0.6.4", 230 | "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.6.4.tgz", 231 | "integrity": "sha512-NpO/87CKnF4Q9r8gMl6w+jPKOM/C089qExkViD9cPvcFZEnyVOu7ucGzcMmTcabWOU62iQTOkRViPYr6XaK0LQ==", 232 | "requires": { 233 | "@jimp/plugin-blit": "^0.6.4", 234 | "@jimp/plugin-blur": "^0.6.4", 235 | "@jimp/plugin-color": "^0.6.4", 236 | "@jimp/plugin-contain": "^0.6.4", 237 | "@jimp/plugin-cover": "^0.6.4", 238 | "@jimp/plugin-crop": "^0.6.4", 239 | "@jimp/plugin-displace": "^0.6.4", 240 | "@jimp/plugin-dither": "^0.6.4", 241 | "@jimp/plugin-flip": "^0.6.4", 242 | "@jimp/plugin-gaussian": "^0.6.4", 243 | "@jimp/plugin-invert": "^0.6.4", 244 | "@jimp/plugin-mask": "^0.6.4", 245 | "@jimp/plugin-normalize": "^0.6.4", 246 | "@jimp/plugin-print": "^0.6.4", 247 | "@jimp/plugin-resize": "^0.6.4", 248 | "@jimp/plugin-rotate": "^0.6.4", 249 | "@jimp/plugin-scale": "^0.6.4", 250 | "core-js": "^2.5.7", 251 | "timm": "^1.6.1" 252 | } 253 | }, 254 | "@jimp/png": { 255 | "version": "0.6.4", 256 | "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.6.4.tgz", 257 | "integrity": "sha512-qv3oo6ll3XWVIToBwVC1wQX0MFKwpxbe2o+1ld9B4ZDavqvAHzalzcmTd/iyooI85CVDAcC3RRDo66oiizGZCQ==", 258 | "requires": { 259 | "@jimp/utils": "^0.6.4", 260 | "core-js": "^2.5.7", 261 | "pngjs": "^3.3.3" 262 | } 263 | }, 264 | "@jimp/tiff": { 265 | "version": "0.6.4", 266 | "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.6.4.tgz", 267 | "integrity": "sha512-8/vD4qleexmhPdppiu6fSstj/n/kGNTn8iIlf1emiqOuMN2PL9q5GOPDWU0xWdGNyJMMIDXJPgUFUkKfqXdg7w==", 268 | "requires": { 269 | "core-js": "^2.5.7", 270 | "utif": "^2.0.1" 271 | } 272 | }, 273 | "@jimp/types": { 274 | "version": "0.6.4", 275 | "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.6.4.tgz", 276 | "integrity": "sha512-/EMbipQDg5U6DnBAgcSiydlMBRYoKhnaK7MJRImeTzhDJ6xfgNOF7lYq66o0kmaezKdG/cIwZ1CLecn2y3D8SQ==", 277 | "requires": { 278 | "@jimp/bmp": "^0.6.4", 279 | "@jimp/gif": "^0.6.4", 280 | "@jimp/jpeg": "^0.6.4", 281 | "@jimp/png": "^0.6.4", 282 | "@jimp/tiff": "^0.6.4", 283 | "core-js": "^2.5.7", 284 | "timm": "^1.6.1" 285 | } 286 | }, 287 | "@jimp/utils": { 288 | "version": "0.6.4", 289 | "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.6.4.tgz", 290 | "integrity": "sha512-EFQurCyEnZLSM2Q1BYDTUmsOJPSOYEQd18Fvq8bGo8hnBHoGLWLWWyNi2l4cYhtpKmIXyhvQqa6/WaEpKPzvqA==", 291 | "requires": { 292 | "core-js": "^2.5.7" 293 | } 294 | }, 295 | "any-base": { 296 | "version": "1.1.0", 297 | "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", 298 | "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" 299 | }, 300 | "base64-js": { 301 | "version": "1.3.0", 302 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", 303 | "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" 304 | }, 305 | "bmp-js": { 306 | "version": "0.1.0", 307 | "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", 308 | "integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=" 309 | }, 310 | "buffer": { 311 | "version": "5.2.1", 312 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", 313 | "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", 314 | "requires": { 315 | "base64-js": "^1.0.2", 316 | "ieee754": "^1.1.4" 317 | } 318 | }, 319 | "buffer-equal": { 320 | "version": "0.0.1", 321 | "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", 322 | "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=" 323 | }, 324 | "core-js": { 325 | "version": "2.6.5", 326 | "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", 327 | "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==" 328 | }, 329 | "define-properties": { 330 | "version": "1.1.3", 331 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 332 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", 333 | "requires": { 334 | "object-keys": "^1.0.12" 335 | } 336 | }, 337 | "dom-walk": { 338 | "version": "0.1.1", 339 | "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", 340 | "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" 341 | }, 342 | "es-abstract": { 343 | "version": "1.13.0", 344 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", 345 | "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", 346 | "requires": { 347 | "es-to-primitive": "^1.2.0", 348 | "function-bind": "^1.1.1", 349 | "has": "^1.0.3", 350 | "is-callable": "^1.1.4", 351 | "is-regex": "^1.0.4", 352 | "object-keys": "^1.0.12" 353 | } 354 | }, 355 | "es-to-primitive": { 356 | "version": "1.2.0", 357 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", 358 | "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", 359 | "requires": { 360 | "is-callable": "^1.1.4", 361 | "is-date-object": "^1.0.1", 362 | "is-symbol": "^1.0.2" 363 | } 364 | }, 365 | "exif-parser": { 366 | "version": "0.1.12", 367 | "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", 368 | "integrity": "sha1-WKnS1ywCwfbwKg70qRZicrd2CSI=" 369 | }, 370 | "file-type": { 371 | "version": "9.0.0", 372 | "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", 373 | "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==" 374 | }, 375 | "for-each": { 376 | "version": "0.3.3", 377 | "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", 378 | "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", 379 | "requires": { 380 | "is-callable": "^1.1.3" 381 | } 382 | }, 383 | "function-bind": { 384 | "version": "1.1.1", 385 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 386 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 387 | }, 388 | "global": { 389 | "version": "4.3.2", 390 | "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", 391 | "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", 392 | "requires": { 393 | "min-document": "^2.19.0", 394 | "process": "~0.5.1" 395 | } 396 | }, 397 | "has": { 398 | "version": "1.0.3", 399 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 400 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 401 | "requires": { 402 | "function-bind": "^1.1.1" 403 | } 404 | }, 405 | "has-symbols": { 406 | "version": "1.0.0", 407 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", 408 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" 409 | }, 410 | "ieee754": { 411 | "version": "1.1.13", 412 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", 413 | "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" 414 | }, 415 | "is-callable": { 416 | "version": "1.1.4", 417 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", 418 | "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" 419 | }, 420 | "is-date-object": { 421 | "version": "1.0.1", 422 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", 423 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" 424 | }, 425 | "is-function": { 426 | "version": "1.0.1", 427 | "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", 428 | "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" 429 | }, 430 | "is-regex": { 431 | "version": "1.0.4", 432 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", 433 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", 434 | "requires": { 435 | "has": "^1.0.1" 436 | } 437 | }, 438 | "is-symbol": { 439 | "version": "1.0.2", 440 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", 441 | "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", 442 | "requires": { 443 | "has-symbols": "^1.0.0" 444 | } 445 | }, 446 | "jimp": { 447 | "version": "0.6.4", 448 | "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.6.4.tgz", 449 | "integrity": "sha512-WQVMoNhkcq/fgthZOWeMdIguCVPg+t4PDFfSxvbNcrECwl8eq3/Ou2whcFWWjyW45m43yAJEY2UT7acDKl6uSQ==", 450 | "requires": { 451 | "@babel/polyfill": "^7.0.0", 452 | "@jimp/custom": "^0.6.4", 453 | "@jimp/plugins": "^0.6.4", 454 | "@jimp/types": "^0.6.4", 455 | "core-js": "^2.5.7" 456 | } 457 | }, 458 | "jpeg-js": { 459 | "version": "0.3.4", 460 | "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.3.4.tgz", 461 | "integrity": "sha512-6IzjQxvnlT8UlklNmDXIJMWxijULjqGrzgqc0OG7YadZdvm7KPQ1j0ehmQQHckgEWOfgpptzcnWgESovxudpTA==" 462 | }, 463 | "load-bmfont": { 464 | "version": "1.4.0", 465 | "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.0.tgz", 466 | "integrity": "sha512-kT63aTAlNhZARowaNYcY29Fn/QYkc52M3l6V1ifRcPewg2lvUZDAj7R6dXjOL9D0sict76op3T5+odumDSF81g==", 467 | "requires": { 468 | "buffer-equal": "0.0.1", 469 | "mime": "^1.3.4", 470 | "parse-bmfont-ascii": "^1.0.3", 471 | "parse-bmfont-binary": "^1.0.5", 472 | "parse-bmfont-xml": "^1.1.4", 473 | "phin": "^2.9.1", 474 | "xhr": "^2.0.1", 475 | "xtend": "^4.0.0" 476 | } 477 | }, 478 | "mime": { 479 | "version": "1.6.0", 480 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 481 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 482 | }, 483 | "mime-db": { 484 | "version": "1.40.0", 485 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 486 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 487 | }, 488 | "mime-types": { 489 | "version": "2.1.24", 490 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 491 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 492 | "requires": { 493 | "mime-db": "1.40.0" 494 | } 495 | }, 496 | "min-document": { 497 | "version": "2.19.0", 498 | "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", 499 | "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", 500 | "requires": { 501 | "dom-walk": "^0.1.0" 502 | } 503 | }, 504 | "minimist": { 505 | "version": "0.0.8", 506 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 507 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" 508 | }, 509 | "mkdirp": { 510 | "version": "0.5.1", 511 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 512 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 513 | "requires": { 514 | "minimist": "0.0.8" 515 | } 516 | }, 517 | "object-keys": { 518 | "version": "1.1.1", 519 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", 520 | "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" 521 | }, 522 | "omggif": { 523 | "version": "1.0.9", 524 | "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.9.tgz", 525 | "integrity": "sha1-3LcCTazVDFK00wPwSALJHAV8dl8=" 526 | }, 527 | "pako": { 528 | "version": "1.0.10", 529 | "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", 530 | "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" 531 | }, 532 | "parse-bmfont-ascii": { 533 | "version": "1.0.6", 534 | "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", 535 | "integrity": "sha1-Eaw8P/WPfCAgqyJ2kHkQjU36AoU=" 536 | }, 537 | "parse-bmfont-binary": { 538 | "version": "1.0.6", 539 | "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", 540 | "integrity": "sha1-0Di0dtPp3Z2x4RoLDlOiJ5K2kAY=" 541 | }, 542 | "parse-bmfont-xml": { 543 | "version": "1.1.4", 544 | "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", 545 | "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", 546 | "requires": { 547 | "xml-parse-from-string": "^1.0.0", 548 | "xml2js": "^0.4.5" 549 | } 550 | }, 551 | "parse-headers": { 552 | "version": "2.0.2", 553 | "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", 554 | "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==", 555 | "requires": { 556 | "for-each": "^0.3.3", 557 | "string.prototype.trim": "^1.1.2" 558 | } 559 | }, 560 | "phin": { 561 | "version": "2.9.3", 562 | "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", 563 | "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" 564 | }, 565 | "pixelmatch": { 566 | "version": "4.0.2", 567 | "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", 568 | "integrity": "sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=", 569 | "requires": { 570 | "pngjs": "^3.0.0" 571 | } 572 | }, 573 | "pngjs": { 574 | "version": "3.4.0", 575 | "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", 576 | "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" 577 | }, 578 | "process": { 579 | "version": "0.5.2", 580 | "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", 581 | "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" 582 | }, 583 | "regenerator-runtime": { 584 | "version": "0.13.2", 585 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", 586 | "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" 587 | }, 588 | "sax": { 589 | "version": "1.2.4", 590 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 591 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 592 | }, 593 | "string.prototype.trim": { 594 | "version": "1.1.2", 595 | "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", 596 | "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", 597 | "requires": { 598 | "define-properties": "^1.1.2", 599 | "es-abstract": "^1.5.0", 600 | "function-bind": "^1.0.2" 601 | } 602 | }, 603 | "timm": { 604 | "version": "1.6.1", 605 | "resolved": "https://registry.npmjs.org/timm/-/timm-1.6.1.tgz", 606 | "integrity": "sha512-hqDTYi/bWuDxL2i6T3v6nrvkAQ/1Bc060GSkVEQZp02zTSTB4CHSKsOkliequCftQaNRcjRqUZmpGWs5FfhrNg==" 607 | }, 608 | "tinycolor2": { 609 | "version": "1.4.1", 610 | "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", 611 | "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" 612 | }, 613 | "utif": { 614 | "version": "2.0.1", 615 | "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", 616 | "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", 617 | "requires": { 618 | "pako": "^1.0.5" 619 | } 620 | }, 621 | "xhr": { 622 | "version": "2.5.0", 623 | "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", 624 | "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", 625 | "requires": { 626 | "global": "~4.3.0", 627 | "is-function": "^1.0.1", 628 | "parse-headers": "^2.0.0", 629 | "xtend": "^4.0.0" 630 | } 631 | }, 632 | "xml-parse-from-string": { 633 | "version": "1.0.1", 634 | "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", 635 | "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=" 636 | }, 637 | "xml2js": { 638 | "version": "0.4.19", 639 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", 640 | "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", 641 | "requires": { 642 | "sax": ">=0.6.0", 643 | "xmlbuilder": "~9.0.1" 644 | } 645 | }, 646 | "xmlbuilder": { 647 | "version": "9.0.7", 648 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", 649 | "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" 650 | }, 651 | "xtend": { 652 | "version": "4.0.1", 653 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", 654 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" 655 | } 656 | } 657 | } 658 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lambda-email", 3 | "version": "1.0.0", 4 | "description": "Lambda function for sending emails", 5 | "main": "index.js", 6 | "author": "Systango", 7 | "license": "ISC", 8 | "dependencies": { 9 | "aws-sdk": "^2.437.0", 10 | "jimp": "^0.6.4", 11 | "mime-types": "^2.1.24" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /postman_collection/lambda-image-resize.postman_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "a2cc58ac-7857-4521-ab4d-adc54b14e56d", 4 | "name": "lambda-image-resize", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "lambda-image-resizer", 10 | "request": { 11 | "method": "GET", 12 | "header": [ 13 | { 14 | "key": "Content-Type", 15 | "name": "Content-Type", 16 | "value": "application/json", 17 | "type": "text" 18 | }, 19 | { 20 | "key": "x-api-key", 21 | "value": "", 22 | "type": "text" 23 | } 24 | ], 25 | "body": { 26 | "mode": "raw", 27 | "raw": "" 28 | }, 29 | "url": { 30 | "raw": "?imageUrl=https://s3.amazonaws.com/towlot-portal-images/1551975541895.JPG&height=200", 31 | "host": [ 32 | "" 33 | ], 34 | "query": [ 35 | { 36 | "key": "imageUrl", 37 | "value": "https://s3.amazonaws.com/towlot-portal-images/1551975541895.JPG" 38 | }, 39 | { 40 | "key": "height", 41 | "value": "200" 42 | } 43 | ] 44 | } 45 | }, 46 | "response": [] 47 | } 48 | ] 49 | } -------------------------------------------------------------------------------- /serverless.yml: -------------------------------------------------------------------------------- 1 | service: image-resize 2 | 3 | provider: 4 | name: aws 5 | runtime: nodejs8.10 6 | region: ap-south-1 7 | apiKeys: 8 | - ${env:MY_API_KEY} 9 | usagePlan: 10 | quota: 11 | limit: 50 #The maximum number of requests that can be made in a given time period. 12 | offset: 2 #The number of requests subtracted from the given limit in the initial time period. 13 | period: MONTH #The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH". 14 | throttle: 15 | burstLimit: 10 #The maximum API request rate limit over a time ranging from one to a few seconds. The maximum API request rate limit depends on whether the underlying token bucket is at its full capacity. 16 | rateLimit: 10 #The API request steady-state rate limit (average requests per second over an extended period of time) 17 | 18 | 19 | functions: 20 | imageResize: 21 | handler: handler.imageResize 22 | 23 | events: 24 | - http: 25 | path: image/resize 26 | method: get 27 | cors: true 28 | private: true 29 | 30 | --------------------------------------------------------------------------------