6
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CPUバーストUnlimitedのEC2さんに乱暴したら課金された

Last updated at Posted at 2020-07-26

秘密鍵を10億個作ろうとして遊休サーバーを使い始めたら、CPUバーストがUnlimitedであることに気づきました。危ない危ない。

以下のコマンドでEC2が自分の望む状態になるようコントロールしましょう。

# 一覧を出す。
$ aws ec2  describe-instance-credit-specifications
{
    "InstanceCreditSpecifications": [
        {
            "InstanceId": "i-1234567890abcdef0",
            "CpuCredits": "unlimited"
        },
        { 
            "InstanceId": "i-1234567890abcdef0",
            "CpuCredits": "unlimited"
        }
    ]
}

# インスタンスIDを指定してstandardにする
$ aws ec2 modify-instance-credit-specification --instance-credit-specification "InstanceId=i-1234567890abcdef0,CpuCredits=standard"
{
    "SuccessfulInstanceCreditSpecifications": [
        {
            "InstanceId": "i-1234567890abcdef0"
        }
    ],
    "UnsuccessfulInstanceCreditSpecifications": []
}


# インスタンスIDを指定してunlimitedにする
$ aws ec2 modify-instance-credit-specification --instance-credit-specification "InstanceId=i-1234567890abcdef0,CpuCredits=unlimited"
{
    "SuccessfulInstanceCreditSpecifications": [
        {
            "InstanceId": "i-1234567890abcdef0"
        }
    ],
    "UnsuccessfulInstanceCreditSpecifications": []
}

参考

6
11
3

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
6
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?