ちょっと話題の記事

[NEW] サービス制限を管理する AWS Service Quotas がリリースされました!

2019.06.25

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは 園部です。

サービス制限を管理する AWS Service Quotas がリリースされました!

Introducing Service Quotas: View and manage your quotas for AWS services from one central location

AWS では、特定サービス・リソースに対して制限を設けています。その制限を緩和するにはサポートチケットから依頼する必要があります。また利用状況を把握するには、Trusted Advisor から確認します。

サポートプランがビジネスプラン以上であれば、CloudWatchと連携してアラートを通知することも可能です。

Trusted Advisor のチェック結果をCloudWatch で通知する

今回、このサービス制限に関する新しいサービスがリリースされました!

AWS Service Quotas とは?

Service Quotas is an AWS service that enables you to view and manage your quotas from a central location. Quotas, also referred to as limits, are the maximum value for your resources, actions, and items in your AWS account. Throughout the AWS documentation and console, you'll see the terms, service quotas and service limits used interchangeably. Each AWS service defines its quotas and establishes default values for those quotas. Depending on your business needs, it may be necessary to increase your service quota values. The Service Quotas console makes it easy to quickly look up available service quotas, and request increases for those quotas.

(引用: 公式ドキュメント

  • 現在、英語のみとなっています。
  • ドキュメント一覧 には、まだ表示されていないようです。(2019/06/25 時点)

できること

  • サービス制限情報の可視化
  • 上限緩和申請
  • CloudWatch による制限サービスの利用状況表示と監視・通知
    ※ ドキュメント内にある supported list of AWS services リンクが正しくないようです。(2019/06/25 時点)
  • IAMによる権限管理
  • Organization によるテンプレート管理と適用
    ※ 環境の都合上、Organization 部分は割愛します。

やってみる

1. マネジメントコンソールから Service Quotas へアクセス

マネジメントコンソールの言語設定によってヒットする検索ワードが異なるのでご注意ください。

  • 日本語: サービスクォータ
  • 英語: Service Quotas

※ 一覧には表示されていないようです。(2019/06/25 時点)

2. サービス制限情報の確認

ダッシュボード

アクセスをすると ダッシュボード が表示されます。
上段で、ダッシュボードカードとして9つのサービスが表示さています。(この9つのサービスは変更が可能です)
下段では、申請したリクエストを状態別に表示しています。

ダッシュボードカードを変更する を選択

1つ削除して、Systems Manager を追加 > 保存 を選択

サービス一覧

制限の対象となっているサービス一覧が表示されます。

サービス詳細

特定のサービスを検索します。(ここでは、EC2を検索)

EC2 内で、制限対象となっている一覧が表示されます。

以下の情報を表示することが可能です。

  • サービスクォータ
  • 適用されたクォータ
  • AWS のデフォルトのクォータ
  • 調整可能
  • Quota コード
  • 使用率

申請履歴

申請したリクエストが表示されます。(申請中のリクエストも表示)

3. 上限緩和申請(マネジメントコンソール編)

マネジメントコンソールから上限緩和申請を行います。

サービスクォータ > AWS サービス > Amazon Elastic Compute Cloud (Amazon EC2) > Number of EIPs - VPC EIPs を選択

クォータ引き上げリクエスト を選択

変更したい制限値を入力 > リクエスト を選択

サポートセンター > Limit Increase: Elastic IPs を選択
以下のようにサポートケースが作成されます。

しばらくすると、AWSサポート側で対応されます。
以下は固定のため注意が必要です。

社内のメンバーから上限緩和申請では、緊急度の選択は出来ないと指摘をもらいました。。
訂正させていただきます。

  • 緊急度: ビジネスに影響する質問
  • 追加の連絡先: -

制限値が 5 から 7 へ変更されています。

4. 上限緩和申請(CLI編)

今後は、CLIから操作と上限申請を行います。
実行環境としては以下の通りです。

$ aws --version
aws-cli/1.16.185 Python/2.7.10 Darwin/18.6.0 botocore/1.12.175

AWS CLI Reference は既に記載されています。

ここでは、3つ利用していきます。

  • 対象サービスリスト表示( service-quotas list-services )
$ aws service-quotas list-services
--------------------------------------------------------------------------------------------------------
|                                             ListServices                                             |
+------------------------------------------------------------------------------------------------------+
||                                              Services                                              ||
|+--------------------------+-------------------------------------------------------------------------+|
||        ServiceCode       |                               ServiceName                               ||
|+--------------------------+-------------------------------------------------------------------------+|
||  acm                     |  AWS Certificate Manager (ACM)                                          ||
||  acm-pca                 |  AWS Certificate Manager Private Certificate Authority (ACM PCA)        ||
||  apigateway              |  Amazon API Gateway                                                     ||

(省略)
  • 対象サービス制限表示(list-service-quotas)
$ aws service-quotas list-service-quotas --service-code ec2
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                                                             ListServiceQuotas                                                                                                             |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
||                                                                                                                 Quotas                                                                                                                  ||
|+------------+--------------+--------------------------------------------------------------------+-------------+--------------------------------------------+--------------+--------------------------------------------+-------+---------+|
|| Adjustable | GlobalQuota  |                             QuotaArn                               |  QuotaCode  |                 QuotaName                  | ServiceCode  |                ServiceName                 | Unit  |  Value  ||
|+------------+--------------+--------------------------------------------------------------------+-------------+--------------------------------------------+--------------+--------------------------------------------+-------+---------+|
||  True      |  False       |  arn:aws:servicequotas:ap-northeast-1:アカウントID:ec2/L-00000000  |  L-00000000 |  Running On-Demand c1.medium instances     |  ec2         |  Amazon Elastic Compute Cloud (Amazon EC2) |  None |  21.0   ||
||  True      |  False       |  arn:aws:servicequotas:ap-northeast-1:アカウントID:ec2/L-11111111  |  L-11111111 |  Running On-Demand c1.xlarge instances     |  ec2         |  Amazon Elastic Compute Cloud (Amazon EC2) |  None |  21.0   ||

(省略)
  • 上限緩和申請(request-service-quota-increase)
$ aws service-quotas request-service-quota-increase --service-code ec2 --quota-code L-22222222 --desired-value 21
---------------------------------------------------------------------------------------------------------
|                                      RequestServiceQuotaIncrease                                      |
+-------------------------------------------------------------------------------------------------------+
||                                           RequestedQuota                                            ||
|+--------------+--------------------------------------------------------------------------------------+|
||  Created     |  1561439973.95                                                                       ||
||  DesiredValue|  21.0                                                                                ||
||  GlobalQuota |  False                                                                               ||
||  Id          |  177ad737fa3d44e6a1b199813532f16bquF9uDAv                                            ||
||  QuotaArn    |  arn:aws:servicequotas:ap-northeast-1:アカウントID:ec2/L-22222222                       ||
||  QuotaCode   |  L-22222222                                                                          ||
||  QuotaName   |  Running On-Demand t2.micro instances                                                ||
||  Requester   |  {"accountId":"アカウントID","callerArn":"arn:aws:iam::アカウントID:user/ユーザー名"}     ||
||  ServiceCode |  ec2                                                                                 ||
||  ServiceName |  Amazon Elastic Compute Cloud (Amazon EC2)                                           ||
||  Status      |  PENDING                                                                             ||
||  Unit        |  None                                                                                ||
|+--------------+--------------------------------------------------------------------------------------+|

サポートセンター > Limit Increase: EC2 Instances を選択
以下のようにサポートケースが作成されます。

しばらくすると、AWSサポート側で対応されます。

制限値が 20 から 21 へ変更されています。

5. CloudWatch による表示とアラーム設定

CloudWatch を利用して現在の利用状況を表示・アラーム設定を行なっていきます。
ニーズとして多そうな特定インスタンスタイプを例としたかったのですが対象ではないようでしたので、ここでは 冒頭のリリース記事 の方法を確認するだけとします。

サービスクォータ > AWSサービス > AWS Lambda > Concurrent executions を選択

CloudWatch を利用して状況表示やアラーム設定が可能な場合は、以下の画面が続けて表示されます。

作成 を選択

デフォルトの制限値に対してのしきい値とアラーム名を入力して 作成 を選択

CloudWatch アラームに追加されました。(余談ですが、CloudWatch アラームのコンソールUIが変わっています)

6. IAM権限

Service Quotas 用3つポリシーが準備されています。

ポリシー名 説明
ServiceQuotasServiceRolePolicy Grants read-only access to Service Quotas.(読み取り)
ServiceQuotasServiceFulllAccess Provides full access to Service Quotas operations.(フル権限)
ServiceQuotasServiceRolePolicy This policy allows Service Quotas to create support cases on your behalf.(サポートケース起票)

さいごに

このサービスでは、一定の緊急度でサポートケースを起票するため、検証として実施するのは最低限としましょう。。AWS サポートチームの皆さん。先ほどは3件ほど失礼しました。

(function(){
    var corecss = document.createElement('link');
    var themecss = document.createElement('link');
    var corecssurl = "https://dev.classmethod.jp/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.9b";
    if ( corecss.setAttribute ) {
            corecss.setAttribute( "rel", "stylesheet" );
            corecss.setAttribute( "type", "text/css" );
            corecss.setAttribute( "href", corecssurl );
    } else {
            corecss.rel = "stylesheet";
            corecss.href = corecssurl;
    }
    document.getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("syntaxhighlighteranchor") );
    var themecssurl = "/wp-content/themes/regeneration/plugins/syntaxhighlighter/styles/shCoreDevIO.css?ver=3.0.9b";
    if ( themecss.setAttribute ) {
            themecss.setAttribute( "rel", "stylesheet" );
            themecss.setAttribute( "type", "text/css" );
            themecss.setAttribute( "href", themecssurl );
    } else {
            themecss.rel = "stylesheet";
            themecss.href = themecssurl;
    }
    //document.getElementById("syntaxhighlighteranchor").appendChild(themecss);
    document.getElementsByTagName("head")[0].insertBefore( themecss, document.getElementById("syntaxhighlighteranchor") );
})();
SyntaxHighlighter.config.strings.expandSource = 'ソースを表示';
SyntaxHighlighter.config.strings.help = 'SyntaxHighlighterについて';
SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n';
SyntaxHighlighter.config.strings.noBrush = '指定のブラシが見つかりませんでした: ';
SyntaxHighlighter.config.strings.brushNotHtmlScript = 'HTMLスクリプトのオプションのためにブラシが構成されませんでした: ';
SyntaxHighlighter.defaults['pad-line-numbers'] = false;
SyntaxHighlighter.defaults['tab-size'] = 2;
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();