{"id":18546199,"url":"https://github.com/huksley/aws-resize-function","last_synced_at":"2026-05-02T03:03:01.581Z","repository":{"id":145826966,"uuid":"184999656","full_name":"huksley/aws-resize-function","owner":"huksley","description":"[Find Face Project] Typescript AWS Lambda to resize image in S3","archived":false,"fork":false,"pushed_at":"2020-01-26T15:20:58.000Z","size":2449,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T09:31:39.418Z","etag":null,"topics":["aws","crop","lambda","resize","s3","typescript"],"latest_commit_sha":null,"homepage":"https://find-face.ruslan.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huksley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-05T08:05:31.000Z","updated_at":"2020-01-26T15:21:00.000Z","dependencies_parsed_at":"2023-04-05T00:30:51.201Z","dependency_job_id":null,"html_url":"https://github.com/huksley/aws-resize-function","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Faws-resize-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Faws-resize-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Faws-resize-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Faws-resize-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huksley","download_url":"https://codeload.github.com/huksley/aws-resize-function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254289302,"owners_count":22046069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","crop","lambda","resize","s3","typescript"],"created_at":"2024-11-06T20:24:01.170Z","updated_at":"2026-05-02T03:03:01.482Z","avatar_url":"https://github.com/huksley.png","language":"TypeScript","readme":"# AWS Resize\n\n[![Sponsored](https://img.shields.io/badge/chilicorn-sponsored-brightgreen.svg)](http://spiceprogram.org/oss-sponsorship)\n\nResizes S3 stored image using NodeJS [sharp](https://github.com/lovell/sharp) library\n\n![Integration](./integration.png)\n\n  * Typescript\n  * Unit and e2e tests\n  * Configuration\n  * Deployment using [Serverless framework](https://serverless.com)\n  * Connect to API Gateway and existing S3 bucket\n  * Payload testing using [io-ts](https://github.com/gcanti/io-ts)\n\n## Settings and private keys management\n\nThis project uses [chamber CLI](https://github.com/segmentio/chamber) tool to manage project \nsettings and private values. \n\nVariables are stored in [AWS Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html) with specified prefix.\n\nTo read more about chamber, take a look at my article [Using AWS and segment.io/chamber CLI for managing secrets for your projects](https://medium.com/@ruslanfg/using-segment-io-chamber-for-managing-secrets-for-your-hobby-projects-2e08faaee5e2)\n\n## Installing\n\n  * Create AWS S3 bucket\n  * Install [Chamber CLI](https://github.com/segmentio/chamber/wiki/Installation)\n  * `\u003e yarn`\n  * `\u003e yarn lint \u0026\u0026 yarn format \u0026\u0026 yarn build`\n\n## Testing\n\nThis project have unit tests and end-to-end tests integrated. Variables and AWS settings to \nrun E2E tests are taken from environment and from AWS Parameter Store.\n\n### Run unit tests\n\nExecute `yarn mocha` to run all tests from `./test` directory.\n\n### Run end-to-end tests\n\nCopy files in `./test-assets/` folder to the S3 bucket of your choice.\nDefine parameters in AWS Parameter store or in local environment:\n\n  * TEST_E2E=1\n  * E2E_IMAGE_URL=s3://my-image-bucket/image.jpg\n\nAfter that run together with chamber CLI by using `yarn test` or by `yarn mocha` if using environment variables.\n\n## Deploying\n\nTo deploy using variables and settings defined in AWS Parameter Store, use `yarn deploy`\nto deploy using local env variables, use `yarn sls deploy`\n\nRequired variables:\n  * **IMAGE_BUCKET** - S3 bucket name to deploy to \n\n### Deploying on non-Linux OS\n\nIf you are building on MacOS, Windows or other OS, you need to build using Amazon Linux Docker images because sharp library uses binary library components. By default they are built for current OS and when deploying you will have a missing binary error.\n\nWhen deploying not on Linux use Docker:\n\n```\n# Build image to use for deployment\ndocker build -t aws-resize-deployer\n# Deploy from this image\ndocker run -e PROJECT=parameter-store-prefix -v ${HOME}/.aws:/root/.aws:ro aws-resize-deployer yarn deploy\n```\n\n## Running and invoking\n\nAWS Lambda have two subscription for events, API Gateway and S3.\nYou can also invoke Lambda via AWS SDK API, cli or serverless\n\n### Invoking API gateway endpoint\n\nAfter serverless deploys lambda, record API URL endpoint:\n\n```\nServerless: Compiling with Typescript...\nServerless: Using local tsconfig.json\nServerless: Typescript compiled.\nServerless: Packaging service...\nServerless: Excluding development dependencies...\nServerless: Uploading CloudFormation file to S3...\nServerless: Uploading artifacts...\nServerless: Uploading service aws-resize.zip file to S3 (43.26 MB)...\nServerless: Validating template...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\nServerless: Stack update finished...\nService Information\nservice: aws-resize\nstage: dev\nregion: eu-west-1\nstack: aws-resize-dev\nresources: 13\napi keys:\n  None\nendpoints:\n  POST - https://\u003capi-id-here\u003e.execute-api.eu-west-1.amazonaws.com/dev/api/resize\nfunctions:\n  handlePost: aws-resize-dev-handlePost\n\n```\n\nafter that, invoke Lambda passing payload, using specified endpoint\n\n```\ncurl -XPOST -d \"{ \\\"s3Url\\\": \\\"s3://my-image-bucket/image.jpg\\\" }\" \"https://\u003capi-id-here\u003e.execute-api.eu-west-1.amazonaws.com/dev/api/resize\"\n```\n\n### Invoke by placing file to S3 bucket\n\nIn your S3 bucket place jpeg or png file to the folder `/profile-image/`\nLambda will be fired and will create thumnbail in folder `/thumbnail/`\n\n### Check everything works\n\nOpen [AWS CloudWatch logs](https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logs:)\nand browse to **handlePost** or **handleS3** to find logs for specified function.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuksley%2Faws-resize-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuksley%2Faws-resize-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuksley%2Faws-resize-function/lists"}