CentOS Stream 8のAMIはないのでCentOS8からバージョンアップする必要がある

# CentOS Stream 8のイメージは公式に提供されていない
[CentOS Streamへの移行が推奨](https://blog.centos.org/2020/12/future-is-centos-stream/)されるということで試したくなった人も多いかと思います。しかし表題の通り、CentOS Stream 8はEC2 AMIやGCE Imageが公式に提供されていません。ですが、かんたんな操作でCentOS8からCentOS Stream 8への変更が可能です。
この方法でCentOS Stream 8インスタンスを作ったら、いつものようにインスタンスイメージとして作成すれば使えるようになります。
なお、CentOS8 AMIはここで公式配布されています。 https://aws.amazon.com/marketplace/pp/B08KYLN2CG

# 切替方法
[公式ページ](https://www.centos.org/centos-stream/)にも案内がありますが、`centos-release-stream`パッケージをインストールして、`dnf distro-sync`を実行すれば終わります。

```bash
# dnf install centos-release-stream
# dnf distro-sync
# cat /etc/centos-release
CentOS Stream release 8
```
https://www.centos.org/centos-stream/ より

実際に実行してみましょう

```
$ cat /etc/redhat-release # ←現在のバージョンはCentOS 8.3.2011
CentOS Linux release 8.3.2011
$ uname -a
Linux ip-172-31-41-96.ap-northeast-1.compute.internal 4.18.0-240.1.1.el8_3.aarch64 #1 SMP Thu Nov 19 22:13:39 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
$ sudo dnf install centos-release-stream # ← centos
CentOS Linux 8 - AppStream                                                               14 MB/s | 5.2 MB     00:00
CentOS Linux 8 - BaseOS                                                                 3.7 MB/s | 1.9 MB     00:00
Dependencies resolved.
========================================================================================================================
 Package                             Architecture          Version                           Repository            Size
========================================================================================================================
Installing:
 centos-release-stream               aarch64               8.1-1.1911.0.7.el8                extras                11 k
 
Transaction Summary
========================================================================================================================
Install  1 Package
 
Total download size: 11 k
Installed size: 6.6 k
Is this ok [y/N]: y
Downloading Packages:
centos-release-stream-8.1-1.1911.0.7.el8.aarch64.rpm                                     53 kB/s |  11 kB     00:00
------------------------------------------------------------------------------------------------------------------------
Total                                                                                    22 kB/s |  11 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                1/1
  Installing       : centos-release-stream-8.1-1.1911.0.7.el8.aarch64                                               1/1
  Verifying        : centos-release-stream-8.1-1.1911.0.7.el8.aarch64                                               1/1
 
Installed:
  centos-release-stream-8.1-1.1911.0.7.el8.aarch64
 
Complete!
$ sudo dnf distro-sync
CentOS-Stream - AppStream                                                               3.2 MB/s | 5.3 MB     00:01
CentOS-Stream - Base                                                                    1.4 MB/s | 1.9 MB     00:01
CentOS-Stream - Extras                                                                  7.8 kB/s | 6.9 kB     00:00
Dependencies resolved.
========================================================================================================================
 Package                                  Arch      Version                                    Repository          Size
========================================================================================================================
Installing:
 centos-stream-release                    noarch    8.4-1.el8                                  Stream-BaseOS       21 k
     replacing  centos-linux-release.noarch 8.3-1.2011.el8
     replacing  centos-release-stream.aarch64 8.1-1.1911.0.7.el8
Upgrading:
 NetworkManager                           aarch64   1:1.30.0-0.2.el8                           Stream-BaseOS      2.3 M
 NetworkManager-libnm                     aarch64   1:1.30.0-0.2.el8                           Stream-BaseOS      1.7 M
（略）
 
Transaction Summary
========================================================================================================================
Install   9 Packages
Upgrade  79 Packages
 
Total download size: 200 M
Is this ok [y/N]: y
Downloading Packages:
(1/88): python3-ethtool-0.14-3.el8.aarch64.rpm                                          303 kB/s |  45 kB     00:00
(2/88): python3-iniparse-0.4-31.el8.noarch.rpm                                          109 kB/s |  49 kB     00:00
（略）
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   9.5 MB/s | 200 MB     00:21
（略）
Complete!
$ cat /etc/redhat-release # ←CentOS Stream 8になった!
CentOS Stream release 8
（OSを再起動する）
$ uname -a # ← カーネルは変わらず
Linux ip-172-31-41-96.ap-northeast-1.compute.internal 4.18.0-240.1.1.el8_3.aarch64 #1 SMP Thu Nov 19 22:13:39 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
```