【注意喚起】2024年7月9日からCognitoのM2M認証(Client Credentials)が有料になります

2024年7月9日から、CognitoのM2M認証(Client Credentials)が有料になります。使ってないアプリケーションクライアントは削除しましょう。
2024.05.13

2024年7月9日から、CognitoのM2M認証(Client Credentials)が有料になる との発表がありました。

M2M認証(Client Credentials)とは?

M2M認証は、Machine to Machine認証の略称で、ユーザーの認証とは別に、アプリケーション間で認証するための仕組みです。

CognitoのM2M認証の具体的な活用例は、こちらのブログが詳しいです。 ご参照ください。

料金

2024/05/13時点では、日本語の料金表には記載されていませんでしたので、英語の料金表を参照してください。

次の2つの観点で料金が発生するようになります。

  • アプリケーションクライアント数(秒単位の日割り計算)
    • 6USD/月(東京リージョン、アプリケーションクライアント数が100以下の場合)
  • トークンのリクエスト数
    • 2.250USD/1,000リクエスト(東京リージョン、リクエスト数250,000以下の場合)

気をつけなければいけないのは、アプリケーションクライアント数の課金でしょう。

今までは無料でしたが、M2M認証を使うための設定であるClient Credentials(クライアント認証情報の付与)を許可する設定をしているだけで課金されるようになります。 意図しない課金を防ぐためにも、M2M認証を使っていない場合はきちんとClient Credentialsフローの許可を外しておくことをおすすめします。

M2M認証(Client Credentials)が有効かの確認

マネジメントコンソールから設定を確認してみます。

ユーザープールの画面から、ユーザープールを選択した後、 アプリケーションの統合 タブを開きます。

確認したい アプリケーションのクライアント を開きます。

この編集画面の、 ホストされたUIOAuth付与タイプクライアント認証情報の付与 が設定されているアプリケーションクライアントが、 課金対象 になります。

編集ボタンを押して、編集画面を開くと、 クライアント認証情報(Client Credentials) を選んででいた場合、 コストが追加されます といった注意書きが表示されるように変わっています。

ユーザープールやアプリケーションクライアントが多い場合は、AWS CLIでも確認できます。

CloudShellを使って次のシェルスクリプトを実行すれば、そのリージョンのClient Credentialsが許可されているアプリケーションクライアントを一覧で表示できます。(最大60個のユーザープールまで)

for userPool in $(aws cognito-idp list-user-pools --max-results 60 --query 'UserPools[].Id' --output text)
do
    for userPoolClient in $(aws cognito-idp list-user-pool-clients --user-pool-id  ${userPool} --query 'UserPoolClients[].ClientId' --output text)
    do
        if [ "$(aws cognito-idp describe-user-pool-client --user-pool-id ${userPool} --client-id ${userPoolClient} --query UserPoolClient.AllowedOAuthFlows --output text | grep "client_credentials")" ]; then
            echo "UserPoolId: ${userPool}, NAME: $(aws cognito-idp describe-user-pool --user-pool-id ${userPool} --query 'UserPool.Name' --output text)" 
            echo "ClientId: ${userPoolClient}, NAME: $(aws cognito-idp describe-user-pool-client --user-pool-id ${userPool} --client-id ${userPoolClient} --query 'UserPoolClient.ClientName' --output text)"
            echo "client_credentials is enabled"
        fi
    done
done

実行するとこんな感じで、Client Credentialsが許可されているアプリケーションクライアントのIDと名前が表示されます。

料金表のFAQ

最後に、料金表のFAQを見てみます。

Q: Is there any change to Amazon Cognito pricing for monthly active users?

A: No, there is no change to Amazon Cognito’s pricing for monthly active users (MAUs).

月間アクティブユーザー(MAU)に関する料金は変更されていないとのことです。 M2M認証(Client Credentials)を使っていない場合は、料金は変わりません。

Q: When will the Amazon Cognito pricing change for M2M support take effect?

A: This pricing change will not take effect until July 9, 2024. On and after July 9, 2024, you will be charged for your use of the M2M capability, unless you are using Amazon Cognito’s M2M capabilities under an exempted customer account.

Q: Which customer accounts are exempted from the pricing change and for how long?

A: Any AWS account that is configured for use with Amazon Cognito M2M before 12:01 AM UTC, May 9, 2024, the day of the pricing announcement, will be exempt from pricing until May 9, 2025. The exemption will be at the AWS account ID level. If your AWS account had an Amazon Cognito user pool configured for machine-to-machine use (OAuth 2.0 client credentials flow with a confidential app client) before May 9, 2024, then that AWS account will be exempt from pricing until May 9, 2025. Any new AWS account IDs and payer ids created and configured for Amazon Cognito’s M2M capabilities will not be charged until July 9, 2024.

Q: Which customer accounts will not be exempted from the pricing change, and when will these non-exempted accounts be charged for M2M use?

A: Any AWS account that starts using Amazon Cognito M2M for the first time on or after May 9, 2024, will not be charged for this feature until July 9, 2024, but will not be eligible for the 12-month exemption. After July 9, 2024, Amazon Cognito M2M usage for these accounts will be billed at standard pricing. Please note that this will apply even if you have other accounts that are eligible for the 12-month exemption.

Q: What specific usage will not be priced in the exempted accounts?

A: Any customer accounts that were already using Amazon Cognito M2M prior to May 9, 2024, will be exempt from pricing until May 9, 2025. This will apply to all M2M app clients and to token requests made to these app clients in the exempted accounts. We will exempt new M2M app clients created in these accounts after the launch of pricing until May 9, 2025. Both token requests and app clients in these accounts will be payable starting May 9, 2025.

この辺は、支払いの免除に関するFAQがわかりにくかったので図にしました。

2024/05/09以前からM2M認証(Client Credentials)を利用している場合、AWSアカウント単位で2025/05/09まで支払いが免除されるそうです。

そうでない場合は、2024/07/09から課金されるようになります。

おわりに

今まで無料のサービスが有料になるということで、情報共有いたしました。

Cognitoのアプリケーションクライアントを作るだけであれば、今までは無料だったので、作って放置されているものも、もしかしたらあるかもしれません。

セキュリティの観点からも使用していないアプリケーションクライアントは削除するよう、お願いいたします。