{"id":25963542,"url":"https://github.com/vladcosorg/action-s3-cloudfront-smart-deploy","last_synced_at":"2025-03-04T20:39:21.730Z","repository":{"id":176438967,"uuid":"653622600","full_name":"vladcosorg/action-s3-cloudfront-smart-deploy","owner":"vladcosorg","description":"S3/Cloudfront Smart Invalidation -  save money on invalidations and maximize cache hits","archived":false,"fork":false,"pushed_at":"2024-04-08T00:32:16.000Z","size":2753,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-04-08T02:13:45.275Z","etag":null,"topics":["action","cloudfront","invalidation","s3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladcosorg.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}},"created_at":"2023-06-14T12:03:38.000Z","updated_at":"2024-07-29T01:20:29.700Z","dependencies_parsed_at":"2023-09-25T04:50:47.531Z","dependency_job_id":"a0c4d44b-0072-48e3-9ebc-4d1f3cfcdc13","html_url":"https://github.com/vladcosorg/action-s3-cloudfront-smart-deploy","commit_stats":null,"previous_names":["vladcosorg/action-s3-cloudfront-smart-deploy"],"tags_count":103,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladcosorg%2Faction-s3-cloudfront-smart-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladcosorg%2Faction-s3-cloudfront-smart-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladcosorg%2Faction-s3-cloudfront-smart-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladcosorg%2Faction-s3-cloudfront-smart-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladcosorg","download_url":"https://codeload.github.com/vladcosorg/action-s3-cloudfront-smart-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241921334,"owners_count":20042762,"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":["action","cloudfront","invalidation","s3"],"created_at":"2025-03-04T20:39:21.071Z","updated_at":"2025-03-04T20:39:21.719Z","avatar_url":"https://github.com/vladcosorg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 style=\"font-weight: normal\" align=\"center\"\u003e\n   \u003cimg alt=\"linkertinker\" src=\"./.github/logoc.svg\" width=\"150\" /\u003e\u003cbr\u003e\n S3/Cloudfront \u003cb style=\"color: #A067FF\"\u003eSmart\u003c/b\u003e Invalidation\n\u003c/h2\u003e\n\n**AWS Cloudfront invalidation requests cost 💰 once you're past the free limit (1000 / account). Issuing wildcard `/_` invalidations is\nnot an option because it causes total cache revalidation and negatively impacts performance.\nThis action provides a smart invalidation algorithm which just works. It issues as few invalidation requests as possible\nwhilst preserving user cache and preventing useless cache drops.**\n\n\u003c!-- toc --\u003e\n\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Invalidation strategies](#invalidation-strategies)\n  - [Balanced](#balanced--recommended)\n  - [Frugal](#frugal)\n  - [Precise](#precise)\n- [Motivation](#motivation)\n- [Full example](#full-example)\n- [License](#license)\n\n\u003c!-- tocstop --\u003e\n\n## Usage\n\n```yaml\n- name: Upload changes to S3 and issue Cloudfront invalidations\n  uses: vladcosorg/action-s3-cloudfront-smart-deploy@v1\n  with:\n    source: local/path/to/dir\n    target: s3://my-bucket-name/\n    distribution: DOAJN11MNDAND\n```\n\n## Configuration\n\n| Key                     | Description                                                                                      | Required | Default    | Value Type                          | Example                                                                  |\n| ----------------------- | ------------------------------------------------------------------------------------------------ | -------- | ---------- | ----------------------------------- | ------------------------------------------------------------------------ |\n| `source`                | Path to sync the files **from**                                                                  | Yes ❗   | N/A        | `path` or `S3 bucket URI`           | `relative/path/to/dir` \u003cbr\u003e `/absolute/path` \u003cbr\u003e `s3://my-bucket-name/` |\n| `target`                | Target s3 bucket to sync **to**                                                                  | Yes ❗   | N/A        | `S3 bucket URI`                     | `s3://my-bucket-name/`                                                   |\n| `s3args`                | [See here](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html)                        | No       | N/A        | `string`                            | `--exact-timestamps --delete`                                            |\n| `distribution`          | Cloudfront distribution ID.                                                                      | No       | N/A        | `string`                            | `DOAJN11MNDAND`                                                          |\n| `cfargs`                | [See here](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html) | No       | N/A        | `string`                            | `--debug`                                                                |\n| `invalidation-strategy` | Invalidation strategy [See description here](#invalidation-strategies)                           | No       | `BALANCED` | `BALANCED` or `PRECISE` or `FRUGAL` | `FRUGAL`                                                                 |\n| `balanced-limit`        | Maximum amount of invalidation requests when using `BALANCED` strategy                           | No       | `5`        | `positive number` or `Ininity`      | 10                                                                       |\n\n### Invalidation strategies\n\n### `BALANCED` ✅ recommended\n\nThis strategy prioritizes issuing as many precise invalidations as possible (within set limits).\nIf this is not possible, it falls back to a hybrid mode which would issue a mix of targeted invalidations and wildcard invalidations.\nAnd finally, if there are too many invalidations, it falls back to wildcard approach, **BUT** the wildcards are\nas specific as possible, so that the consumers of the app would redownload as little as possible.\n\n For example if the value of `balanced-limit` is set to `5`, then it will issue up\nto `5` invalidation requests. The action will never exceed this value.\n\nIf the `balanced-limit` value is too low to perform all necessary precise invalidations, then it will resort to the\nwildcard approach, partially or completely.\n\nThe generated wildcards will try to minimize the number of invalidated files by narrowing its scope.\n\n\u003cdiv  align=\"center\"\u003e\n\u003cimg alt=\"linkertinker\" src=\"./.github/limit3c.svg\" width=\"500\" /\u003e\n\u003cimg alt=\"linkertinker\" src=\"./.github/limit2c.svg\" width=\"500\" /\u003e\n\u003cimg alt=\"linkertinker\" src=\"./.github/limit1c.svg\" width=\"500\" /\u003e\n\u003c/div\u003e\n\n### `FRUGAL`\n\nIt's a shortcut to the `balanced-limit` set to `1`. It means that the action would always issues at most\n1 invalidation request that is going to contain a scoped wildcard if you have more than 1 file that needs\nto be invalidated.\n\n🟠 **Attention**: This option, whilst very economical towards your AWS invalidation quota, would affect many\nunrelated paths. Use with caution.\n\n### `PRECISE`\n\nIt's a shortcut to the `balanced-limit` set to `Infinity`. It means that the action would always issue precise\ninvalidation requests, potentially\n\n🧨 **Warning**: This option could potentially cost you a significant amount of money, because it will issue\n1 invalidation request per 1 changed files. If you have lots of changed files that are frequently deployed to S3, think\nagain before using this option.\n\n## Full example\n\n```yaml\njobs:\n  deploy:\n    name: Upload to Amazon S3\n    runs-on: ubuntu-latest\n    # These permissions are needed to interact with GitHub's OIDC Token endpoint.\n    permissions:\n      id-token: write\n      contents: read\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n      - name: Configure AWS credentials from Test account\n        uses: aws-actions/configure-aws-credentials@v4\n        with:\n          role-to-assume: arn:aws:iam::111111111111:role/my-github-actions-role-test\n          aws-region: us-east-1\n      - name: Upload changes to S3 and issue Cloudfront invalidations\n        uses: vladcosorg/action-s3-cloudfront-smart-deploy@v1\n        with:\n          source: local/path/to/dir\n          target: s3://my-bucket-name/\n          distribution: DOAJN11MNDAND\n```\n\n## Motivation\n\nThe available actions are using a simple yet inefficient approach that invalidates the changes using a precise\n1 file -\u003e 1 invalidation request approach, which potentially can result in a quite large monthly bill, provided that\nyour project is updated frequently and has a lot of files (exactly the case at my company).\nAnother approach is to issue general, root invalidations like `/*` which would cause the consumers of your app\nto redownload the assets which did not actually change.\n\nThis action features a `BALANCED` approach which is as precise and as economical as you want it to be.\n\n## License\n\nThis project is distributed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladcosorg%2Faction-s3-cloudfront-smart-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladcosorg%2Faction-s3-cloudfront-smart-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladcosorg%2Faction-s3-cloudfront-smart-deploy/lists"}