WP Manifestindependent plugin directory
manifest / performance / wp-cloudfront-cache-clear

CloudFront Cache Clear

CloudFrontキャッシュを削除できるWordPressプラグイン。

by KANADEYA · github.com/kanadeya/wp-cloudfront-cache-clear

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/kanadeya/wp-cloudfront-cache-clear/archive/refs/heads/main.zip

WordPressの管理画面からCloudFrontのキャッシュクリアを実行するプラグインです。

Requirements

  • PHP 8.0+
  • WordPress
  • Composer
  • EC2 IAM Role with cloudfront:CreateInvalidation

Installation

cd /path/to/wordpress/wp-content/plugins
git clone <repository-url> cloudfront-cache-clear
cd cloudfront-cache-clear
composer install --no-dev

WordPress管理画面から CloudFront Cache Clear を有効化してください。

Settings

設定 > CloudFront Cache Clear で以下を設定します。

  • Distribution ID
  • Invalidation Paths

Invalidation Paths は1行に1パスを入力します。初期値は /* です。

AWS IAM Policy

EC2に付与するIAMロールには、最低限以下の権限が必要です。

{
  "Effect": "Allow",
  "Action": [
    "cloudfront:CreateInvalidation"
  ],
  "Resource": "*"
}

AWSアクセスキーはWordPressに保存しません。AWS SDKのデフォルト認証チェーンにより、EC2のIAMロールを利用します。