WordPressのSSL証明書を更新[Lightsail][Letsencrypt]

AWS lightsailで作成したwordpressインスタンス上で certbot renew を実行すると、以下のようなエラーが発生する。
Attempting to renew cert (vasteelab.com) from /etc/letsencrypt/renewal/vasteelab.com.conf produced an unexpected error: The manual plugin is not working; there may be problems with your existing configuration. The error was: PluginError('An authentication script must be provided with --manual-auth-h ook when using the manual plugin non-interactively.',). Skipping. All renewal attempts failed. The following certs could not be renewed: /etc/letsencrypt/live/vasteelab.com/fullchain.pem (failure)
このエラーは、1回目に、SSL証明書をマニュアルで作成した場合に発生する。
対処法は、もう一度、マニュアルでSSL証明書の発行を行うことだ。
まず、ドメインとワイルドカードの変数を用意。DOMAINの中身は適宜、自分のものに置き換えてください。
DOMAIN=vasteelab.com WILDCARD=*.$DOMAIN
次に、certbotをインタラクティブモードで起動。
sudo certbot -d $DOMAIN -d $WILDCARD --manual --preferred-challenges dns certonly
プロンプトに応じてメールアドレスの入力を行い、IPアドレスのログ記録に関する質問に応答する。
Let’s Encrypt から、指定されたドメインの所有者であることの検証を求められるため、以下のURLを参考に、ドメインのDNSレコードにTXTレコードを追加。
ここまでの手順を済ませ、Congratulations! のメッセージを確認したら、サーバーを再起動
sudo /opt/bitnami/ctlscript.sh stop sudo /opt/bitnami/ctlscript.sh start
再起動後、SSL証明書の更新が行われ、サイトがこれまで通りhttpsで表示されていることを確認できるはずだ。
しかしAWS LightsailでSSL証明の更新をするのはとても面倒だ。なんとかして自動化したいものだ。