0
0

Ubuntu ProなEC2をLTS に変換する

Last updated at Posted at 2024-09-21

はじめに

こちらでLTS->Proにしたものを元に戻す手順となります。

設定方法

流れ

  • AWSサポートに問い合わせを行い、Ubuntu Pro→LTSにサブスクリプション変更できるように依頼します。
    • 変更許可はリージョン単位となるので、希望リージョンを伝える必要があります。
    • 期間限定(約2週間のあいだ)でサブスクリプション変更ができるようになります。
    • 依頼してから対応完了まで2週間ほどかかっちゃうので余裕をもって依頼したほうが良いです。
  • OS側でサブスクリプションの解除 と Ubuntu Pro関連のパッケージ削除 を実施します。
  • AWS CLIでEC2に付与されているUbuntu ProのサブスクリプションをLTSに変更します。
    • AWSコンソールからはできないです。(LTS→Proはできる)
    • サブスクリプションの変更時はインスタンスの停止が必要です。(LTS→Proは不要)

OSの設定

1.下記を実行します。

$ sudo pro detach

2.確認を求められたら「y」と入力します。

Detach will disable the following services:
    esm-apps
    esm-infra
    livepatch
Are you sure? (y/N) y

3.下記のメッセージが表示されます。

Executing `/snap/bin/canonical-livepatch disable`
This machine is now detached.

メッセージに従ってコマンド実行します。

$ sudo /snap/bin/canonical-livepatch disable

4.確認します。「This machine is not attached to an Ubuntu Pro subscription.」の一文があれば大丈夫です。

$ pro status
SERVICE          AVAILABLE  DESCRIPTION
cc-eal           yes        Common Criteria EAL2 Provisioning Packages
cis              yes        Security compliance and audit tools
esm-apps         yes        Expanded Security Maintenance for Applications
esm-infra        yes        Expanded Security Maintenance for Infrastructure
fips             yes        NIST-certified FIPS crypto packages
fips-updates     yes        FIPS compliant crypto packages with stable security updates
livepatch        yes        Canonical Livepatch service
ros              yes        Security Updates for the Robot Operating System
ros-updates      yes        All Updates for the Robot Operating System

For a list of all Ubuntu Pro services, run 'pro status --all'

This machine is not attached to an Ubuntu Pro subscription.
See https://ubuntu.com/pro

[info] A new version is available: 33.2~18.04
Please run:
    sudo apt install ubuntu-pro-client
to get the latest bug fixes and new features.

5.不要なパッケージを削除します。

$ sudo apt remove ubuntu-advantage-tools
$ sudo apt autoremove

AWS側の設定

1.インスタンスの停止を行う

2.事前確認
PlatformDetailsUbuntu Pro Linux であることを確認します。

aws ec2 describe-instances --profile プロファイル --instance-ids インスタンスID \
--query "Reservations[*].Instances[*].{InstanceId: InstanceId, PlatformDetails: PlatformDetails, UsageOperation: UsageOperation, UsageOperationUpdateTime: UsageOperationUpdateTime}"

3.Ubuntu Pro -> LTS変更を行います。
RunInstances:0g00 は Ubuntu Pro
RunInstances は LTS

aws license-manager create-license-conversion-task-for-resource --profile プロファイル \
--resource-arn インスタンスARN \
--source-license-context UsageOperation=RunInstances:0g00 \
--destination-license-context UsageOperation=RunInstances

4.AWSコンソール AWS License Manager > ライセンスタイプの変換 で進捗状況を確認します。
2分程度で完了します。

5.事後確認を行います。
PlatformDetailsLinux/UNIX となっていることを確認します。

aws ec2 describe-instances --profile プロファイル --instance-ids インスタンスID \
--query "Reservations[*].Instances[*].{InstanceId: InstanceId, PlatformDetails: PlatformDetails, UsageOperation: UsageOperation, UsageOperationUpdateTime: UsageOperationUpdateTime}"

6.インスタンスを起動します、

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0