manifest / performance / lightsail-cdn-control
Lightsail CDN Control
Manage your AWS Lightsail CDN cache from WordPress admin. Clear manually, auto-clear on content updates, or schedule recurring cache invalidation.
by Stephen · github.com/stephenraj1997/lightsail-cdn-control · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/stephenraj1997/lightsail-cdn-control/archive/refs/heads/main.zipA comprehensive WordPress plugin for managing AWS Lightsail CDN cache with manual clearing, automatic invalidation, and flexible scheduling.
Features
🚀 Manual Cache Clearing
- One-click cache invalidation from WordPress admin
- Instant feedback on cache clearing status
- Perfect for immediate control
⚡ Automatic Cache Clearing
- Auto-clear CDN cache when content is published or updated
- Select which post types trigger cache clearing
- Support for all custom post types
- Immediate content updates across your CDN
🕒 Scheduled Cache Clearing
- Daily, weekly, or monthly clearing options
- Choose specific times and days/dates
- Live countdown timer showing next scheduled clear
- Uses your WordPress timezone settings
⚙️ Easy Configuration
- Simple wp-config.php based credentials
- Clear status indicators
- Secure AWS Signature Version 4 authentication
Installation
Via WordPress Admin
- Download the plugin ZIP file
- Go to Plugins > Add New > Upload Plugin
- Choose the ZIP file and click Install Now
- Activate the plugin
- Configure AWS credentials (see Configuration below)
Manual Installation
- Download and extract the plugin
- Upload the
lightsail-cdn-controlfolder to/wp-content/plugins/ - Activate through the WordPress admin
- Configure AWS credentials
Configuration
Add these constants to your wp-config.php file:
define('AWS_ACCESS_KEY_ID', 'your_access_key_here');
define('AWS_SECRET_ACCESS_KEY', 'your_secret_key_here');
define('AWS_DEFAULT_REGION', 'us-east-1');
define('LIGHTSAIL_DISTRIBUTION_NAME', 'your_distribution_name');
Finding Your Distribution Name
- Log in to AWS Lightsail console
- Navigate to Networking > CDN distributions
- Find your distribution and copy its name
Creating AWS Credentials
- Go to AWS IAM console
- Create a new user or use an existing one
- Attach Lightsail permissions policy
- Generate access keys
- Add keys to wp-config.php
Usage
Manual Cache Clearing
- Go to Settings > CDN Control in WordPress admin
- Click Clear CDN Cache Now button
- Confirm the action
- Wait for success notification
Auto-Clear Setup
- Go to Settings > CDN Control
- Enable Auto-Clear toggle
- Select which post types should trigger cache clearing
- Save settings
- Cache will now clear automatically when selected content is updated
Scheduled Clearing
- Go to Settings > CDN Control
- Enable Scheduled Auto-Clear toggle
- Choose frequency (Daily, Weekly, or Monthly)
- Set time of day
- For weekly: choose day of week
- For monthly: choose day of month (1-31)
- Save settings
- View live countdown to next clear
Requirements
- WordPress 5.0 or higher
- PHP 7.2 or higher
- AWS Lightsail distribution with CDN enabled
- AWS Access Key with Lightsail permissions
File Structure
lightsail-cdn-control/
├── admin/
│ └── class-lightsail-cdn-admin.php # Admin interface
├── assets/
│ ├── css/
│ │ └── admin.css # Admin styles
│ └── js/
│ └── admin.js # Admin JavaScript
├── includes/
│ ├── class-lightsail-cdn-core.php # Core plugin class
│ ├── class-lightsail-cdn-aws.php # AWS API handler
│ └── class-lightsail-cdn-scheduler.php # Scheduling logic
├── languages/ # Translation files (future)
├── lightsail-cdn-control.php # Main plugin file
├── uninstall.php # Uninstall cleanup
├── readme.txt # WordPress.org readme
└── README.md # This file
Security
- Credentials stored securely in wp-config.php (not in database)
- Uses AWS Signature Version 4 for authentication
- Nonce verification for all admin actions
- Capability checks for all operations
- No user data collection or transmission
Troubleshooting
Cache Not Clearing
- Verify AWS credentials are correct in wp-config.php
- Check distribution name matches exactly
- Ensure IAM user has Lightsail permissions
- Check error messages in WordPress admin
Scheduled Clear Not Running
- Verify WordPress cron is working
- Check timezone settings in WordPress
- Confirm scheduled clear is enabled
- Look for errors in debug.log
Auto-Clear Not Working
- Ensure auto-clear is enabled
- Verify post types are selected
- Check that post status is "published"
- Confirm AWS credentials are valid
Changelog
Version 1.0 (Initial Release)
- Manual cache clearing functionality
- Automatic cache clearing on content updates
- Scheduled cache clearing (daily, weekly, monthly)
- Live countdown timer for scheduled clears
- Support for custom post types
- Local timezone support
- Comprehensive error reporting
- Modern, responsive admin interface
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
- WordPress Support Forum: Plugin Support
- GitHub Issues: Report Issues
License
This plugin is licensed under the GPLv2 or later.
Copyright (C) 2026 Stephen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Author
Stephen Raj
Made with ❤️ for the WordPress community