手順
リポジトリとソフトウェアのインストール
amazon-linux-extrasでリポジトリのepel(Extra Package for Enterprise Linux)をインストールしました。
その後、certbot-apacheソフトウェアをインストールしました。
sudo amazon-linux-extras install epel
sudo yum install certbot-apache
参考
https://serverfault.com/questions/903780/how-to-install-certbot-on-amazon-linux-ec2
certbotの実行
sudo certbot --apache #オプションでcertonlyをつけて書き換え自身は自分で行うようにすることもできるみたいです
上記で実行して質問に答えたら終了!!
と思ったら、、、
To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided.
エラー発生!!
エラー解決
結論、EC2のインバウンドルールにHTTPのAnywhereを追加して誰でもアクセスできるようにすれば解決できました。
最初見たとき、EC2サーバ自身からドメインに対して問い合わせを行っていると思い、インバウンドルールにEC2のpublic IPを登録したのですが、そうではなく、Let's Encrypt 側からEC2にHTTPアクセスしているみたいです。
