https://github.com/linuxfoundation/cdn-maintenance-toggle
Python script to deploy/remove Cloudfront maintenance pages
https://github.com/linuxfoundation/cdn-maintenance-toggle
Last synced: 25 days ago
JSON representation
Python script to deploy/remove Cloudfront maintenance pages
- Host: GitHub
- URL: https://github.com/linuxfoundation/cdn-maintenance-toggle
- Owner: linuxfoundation
- License: mit
- Created: 2024-04-04T04:53:15.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T21:49:02.000Z (over 1 year ago)
- Last Synced: 2024-12-09T22:33:49.224Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# CDN maintenance toggle script
This script disables or enables CDN services operating on AWS Cloudfront by
setting them into maintenance mode, implemented as a Cloudfront edge function
returning an HTML maintenance page.
Features include:
- Wildcard Domain Matching: Specify matching domain wildcards to limit affected
Cloudfront services in the current AWS account/region.
- IP Whitelisting: Provide IP addresses that are allowed to bypass the outage
page for a disabled site.
- Custom Maintenance Page: Specify a custom HTML template for the outage page.
For more details, run the script with the `--help` option.
## Setup & usage for Linux Foundation / LFX sites
Run the script with the `uv` project manager, which handles both Python version
management and dependencies (Python virtual environments).
The script relies on the environment to provide AWS authentication and
determine which account to connect to. Export the `AWS_PROFILE` environment
variable, or run the script with `aws-vault`, depending on your setup.
```bash
uv run cdn_maintenance_toggle.py --template lfx-maintenance.html -v \
--disable-sites "*.platform.linuxfoundation.org" "*.lfx.dev"
uv run cdn_maintenance_toggle.py -v \
--enable-sites "*.platform.linuxfoundation.org" "*.lfx.dev"
uv run cdn_maintenance_toggle.py --cleanup
```
## Customization
The HTML template `lfx-maintenance.html` is used to display a maintainance
message when CDN servers are disabled. It provided as an example of an outage
page used by the Linux Foundation for LFX Platform maintanance. Remove any
Linux Foundation / LFX branding before using this with any other sites.