{"id":13835342,"url":"https://github.com/sourcey/s3-image-optimizer","last_synced_at":"2025-05-03T13:30:25.749Z","repository":{"id":145284145,"uuid":"51979466","full_name":"sourcey/s3-image-optimizer","owner":"sourcey","description":"Optimize images in large S3 storage buckets","archived":false,"fork":false,"pushed_at":"2017-05-31T11:17:04.000Z","size":8,"stargazers_count":103,"open_issues_count":5,"forks_count":20,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-31T16:13:56.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/sourcey.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}},"created_at":"2016-02-18T04:42:58.000Z","updated_at":"2024-10-13T18:55:52.000Z","dependencies_parsed_at":"2024-01-20T20:27:32.564Z","dependency_job_id":null,"html_url":"https://github.com/sourcey/s3-image-optimizer","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/sourcey%2Fs3-image-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcey%2Fs3-image-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcey%2Fs3-image-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcey%2Fs3-image-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcey","download_url":"https://codeload.github.com/sourcey/s3-image-optimizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224362122,"owners_count":17298642,"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":[],"created_at":"2024-08-04T14:00:59.909Z","updated_at":"2024-11-12T23:24:51.295Z","avatar_url":"https://github.com/sourcey.png","language":"JavaScript","readme":"# Optim\n\nAutomagitically optimize your images on S3 with the magic of AWS Lambda.\n\nOptim is a super-simple [Lambda][l] function that can listen to an S3 bucket for uploads, and runs everything it can through [imagemin][imagemin].\n\n\n## Setup\n\n * Clone this repo\n\n * Run `npm install`\n\n * Fill in `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` in `.env` to a set of credentials that can create Lambda functions (alternatively have these already in your environment)\n\n * Create an IAM role for Optim to use. It needs the following permissions on all the S3 buckets you want to use (allowing these operations on ARN `*` is easiest to start with):\n   * `getObject`\n   * `putObject`\n   * `putObjectAcl`\n\n\n * Find the ARN for this role. It looks something like `arn:aws:iam::1234567890:role/rolename`.\n\n * Fill in `AWS_ROLE_ARN` in `.env`\n\n * Run `npm run deploy`\n\n * Hurrah, your Lambda function is now deployed! It'll be created with the name `optim-production` unless you changed values in `.env`\n\n * You can now hook this function up to any S3 bucket you like in the management console. Easiest way is to follow [AWS's guide][s3-evt-setup]\n\n\n## Configuration\n\nThere are two sets of configuration here. The `.env` file contains configuration related to setup and deployment, and `runtime.env` is for configuration of how Optim behaves.\n\nIn `.env`:\n\n * `AWS_ACCESS_KEY_ID`: the AWS access key used to deploy the Lambda function\n * `AWS_SECRET_ACCESS_KEY`: the corresponding secret access key\n * `AWS_ROLE_ARN`: role with which the lambda function will be executed\n * `AWS_REGION`: which region to deploy to\n * `AWS_FUNCTION_NAME` and `AWS_ENVIRONMENT` control naming of the lambda function created\n * `AWS_MEMORY_SIZE` is the amount of memory given to your Lambda. It's also related to how much CPU share it gets. Since optimizing images is fairly intensive, probably best to keep this high\n * `AWS_TIMEOUT` runtime timeout for the lambda in seconds up to 5 minutes. Again, image optimization is fairly intensive so you'll probably want to leave this at the maximum of 300.\n\nIn `runtime.env`:\n\n * `UPLOAD_ACL`: finalised images will be uploaded with this permission level. Should be one of `private` `public-read` `public-read-write` `aws-exec-read` `authenticated-read` `bucket-owner-read` `bucket-owner-full-control`. Default is `public-read`.\n * `MAX_FILE_SIZE`: files over this size in bytes will be skipped (e.g. big PNGs will probably just hit the timeout anyway). Set to `-1` for no limit\n * `PNG_OPTIM_LEVEL`: Optimization level to use for PNGs, between 0 and 7. Lower level means faster optimization, higher means better results.\n\n\n[l]: https://aws.amazon.com/lambda/\n[imagemin]: https://github.com/imagemin/imagemin\n[s3-evt-setup]: http://docs.aws.amazon.com/AmazonS3/latest/UG/SettingBucketNotifications.html\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcey%2Fs3-image-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcey%2Fs3-image-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcey%2Fs3-image-optimizer/lists"}