Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lambda-web-pr-previews/nodejs/sam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The `prod` endpoint and every `pr-<number>` endpoint therefore use `Disabled`, a

* **Nine previews at a time.** A Web Function can have up to 10 endpoints, and `prod` uses one. When a tenth preview is requested, the script prints the `ServiceQuotaExceededException` error and asks you to close a pull request or run `scripts/deploy.sh delete-preview <number>`.
* **Preview capacity.** Each preview endpoint is limited to 2 execution environments and 100 requests per second, so a preview cannot use the capacity of production.
* **Previews are public.** Every endpoint, including each preview, uses the `ApplicationManaged` authentication type, so anyone with the URL can open it. If previews must stay private, add authentication to your app, or use `IamAuth` endpoints behind Amazon CloudFront ([Lambda Web Function endpoint access control](https://docs.aws.amazon.com/lambda/latest/dg/web-functions-endpoint-access-control.html)).
* **Revisions.** Each push to a pull request adds a revision. Lambda uses 50 revisions per Web Function as its automatic cleanup target and deletes the oldest revisions that no endpoint routes to, which can include older production revisions that you keep for rollback ([Revisions](https://docs.aws.amazon.com/lambda/latest/dg/web-functions-revisions.html)). After each deployment, the `Production` workflow therefore runs `scripts/deploy.sh cleanup`, which deletes the preview revisions that no endpoint routes to: the replaced revisions of open pull requests and all revisions of closed ones. It skips revisions created in the last 60 minutes, so it does not delete a revision that a running preview deployment is about to route, and it fails the workflow step if it cannot read, delete or mark a preview revision. Until the next push to `main`, preview revisions count toward the 50.
* **Code package lifecycle.** Every Web Function revision is pinned to an exact S3 object version. [Deleting a version still used by a revision permanently fails that revision](https://docs.aws.amazon.com/lambda/latest/dg/web-functions-code-s3.html). The bucket therefore expires only preview packages tagged `retired=true`, and `scripts/deploy.sh cleanup` tags a version only after it deletes the revision. Amazon S3 permanently deletes a tagged version 30 days after it becomes noncurrent. A tagged current version, such as the last package of a closed pull request, first gets a delete marker 30 days after upload. Production packages remain untouched so retained revisions can be used for rollback. If a revision could not be deleted, or Lambda already removed it automatically, its package is kept; an upload that fails before a revision is created may also need manual cleanup after you confirm no revision uses that version.

Expand Down
Loading