{"id":16978603,"url":"https://github.com/willdady/aws-cdn-image-resizer","last_synced_at":"2025-04-12T01:41:29.256Z","repository":{"id":46061232,"uuid":"272105731","full_name":"willdady/aws-cdn-image-resizer","owner":"willdady","description":"TypeScript AWS CDK construct which creates an basic image resizing CDN using CloudFront, S3, API Gateway and Lambda.","archived":false,"fork":false,"pushed_at":"2021-11-16T22:22:24.000Z","size":32336,"stargazers_count":5,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T08:48:30.038Z","etag":null,"topics":["aws","aws-cdk","aws-cdk-construct","cdn","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willdady.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-14T00:12:46.000Z","updated_at":"2023-06-20T18:26:50.000Z","dependencies_parsed_at":"2022-08-30T21:20:13.986Z","dependency_job_id":null,"html_url":"https://github.com/willdady/aws-cdn-image-resizer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Faws-cdn-image-resizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Faws-cdn-image-resizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Faws-cdn-image-resizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Faws-cdn-image-resizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willdady","download_url":"https://codeload.github.com/willdady/aws-cdn-image-resizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505742,"owners_count":21115352,"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","aws-cdk","aws-cdk-construct","cdn","nodejs","typescript"],"created_at":"2024-10-14T01:43:48.192Z","updated_at":"2025-04-12T01:41:29.227Z","avatar_url":"https://github.com/willdady.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CDN Image Resizer\n\nTypeScript AWS CDK construct which creates an basic image resizing CDN using CloudFront, S3, API Gateway and Lambda.\n\nOnce deployed images in the deployed S3 bucket are accessible via the deployed CloudFront endpoint e.g.\n\n```\nhttps://d3i3pfoeixxxxx.cloudfront.net/foo.png\n```\n\nTo request a resized version of an image prefix the S3 key with dimensions.\n\n```\nhttps://d3i3pfoeixxxxx.cloudfront.net/200x200/foo.png\n```\n\nDimensions can be specified as `\u003cwidth\u003ex\u003cheight\u003e`, `\u003cwidth\u003e` or `x\u003cheight\u003e` (note the preceding x when specifying height only). Images are resized using [sharp][8] which is deployed as a lambda layer.\n\n### Note\n\n- AWS publishes and maintains [Serverless Image Handler][7], which _may_ be a better choice depending on your use case (does not use AWS CDK).\n\n## Construct Props\n\n| Name                         | Type             | Description                                                                         |\n| ---------------------------- | ---------------- | ----------------------------------------------------------------------------------- |\n| restApiName                  | `string`         | Name for the REST API                                                               |\n| defaultCorsPreflightOptions? | [CorsOptions][1] | CORS options used by the REST API and Lambda function                               |\n| functionMemory?              | `number`         | Amount of memory to assign to lambda function. Default 256.                         |\n| storageClass?                | `string`         | [Storage class][6] used for derived images. Default 'STANDARD_IA'.                  |\n| maxAgeSeconds?               | `number`         | CacheControl to set on derived images written to S3 bucket. Default 604800 (7 days) |\n\n## Props\n\nThe following properties are available on this construct's instance.\n\n| Name                      | Type                           |\n| ------------------------- | ------------------------------ |\n| cloudFrontWebDistribution | [CloudFrontWebDistribution][2] |\n| bucket                    | [Bucket][3]                    |\n| restApi                   | [LambdaRestApi][4]             |\n| resizerFunction           | [Function][5]                  |\n\n## Usage\n\n```typescript\nimport { Construct, Stack, StackProps } from '@aws-cdk/core';\n\nexport class MyStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    const cdnImageResizer = new CDNImageResizer(this, 'CDNImageResizer', {\n      restApiName: 'my-image-resizer-api',\n      defaultCorsPreflightOptions: {\n        allowOrigins: ['example.com'],\n      },\n    });\n  }\n}\n```\n\n[1]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CorsOptions.html\n[2]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.CloudFrontWebDistribution.html\n[3]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html\n[4]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.LambdaRestApi.html\n[5]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html\n[6]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property\n[7]: https://aws.amazon.com/solutions/implementations/serverless-image-handler/\n[8]: https://github.com/lovell/sharp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldady%2Faws-cdn-image-resizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilldady%2Faws-cdn-image-resizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldady%2Faws-cdn-image-resizer/lists"}