Managing Amazon Cognito costs
Amazon Cognito bills your user pools based on the number of active users, the features that you enable, and your request volume. When you understand what drives these charges, you can design user pools that meet your needs at a lower cost. To view and anticipate your Amazon Cognito charges, see Monitoring Amazon Cognito costs.
Amazon Cognito has no contracts, minimum fees, or upfront commitments. Your bill depends mainly on monthly active users (MAUs). Amazon Cognito charges for the following dimensions of your usage.
-
User pool monthly active users (MAUs)—rate varies by feature plan
-
User pool MAUs signed in with OIDC or SAML federation
-
Request volume for machine to machine (M2M) authorization, from both
client_credentialsgrants at the token endpoint and theGetClientTokenAPI operation -
Purchased usage above default quotas for some categories of user pool APIs
Additionally, features of your user pool like email messages, SMS messages, and Lambda
triggers can incur costs in dependent services. For a complete overview, see Amazon Cognito Pricing
The following tips can help you control your Amazon Cognito usage and bill.
Don't activate inactive users
Typical operations that make a user active are sign-in, sign-up, and password reset.
For a more thorough list, see Monthly active users. Amazon Cognito doesn't count inactive users toward your
bill, so avoid operations that make your inactive users active. The AdminGetUser API operation marks a user as active for the month, which adds to your
billed MAUs. To read the attributes of users in your
user pool, use the ListUsers operation and its SDK
Manage request rates
You can provision extra request-rate capacity yourself for each adjustable API category.
You can raise or lower your provisioned limit on the Amazon Cognito console or with the provisioning
API operations, such as UpdateProvisionedLimit. Your
provisioned limit can increase up to your account-level maximum, and changes take effect
immediately. You pay for extra capacity only while you need it. To raise your account-level
maximum, see Requesting a quota increase.
To manage provisioned limits, see Managing provisioned limits. You might also reduce the volume of requests in your
application. For more information, see Optimize request rates for quota limits.
Request a new token only when you need one
Machine to machine (M2M) authorization with client credentials grants can reach a high volume of token requests. Each new token request has an effect on your request-rate quota and the size of your bill. To optimize cost, include token expiration settings and token handling in the design of your applications.
-
Cache access tokens so that when your application requests a new token, it receives a cached version of a previously issued token. When you implement this method, your caching proxy acts as a guard against applications that request access tokens without awareness of the expiration of previously acquired tokens. Caching tokens is ideal for short-lived microservices like Lambda functions and Docker containers.
-
Implement token-handling mechanisms in your applications that account for token expiration. Don’t request a new token until previous tokens are about to expire. As a best practice, refresh tokens at about 75% of the token lifetime. This practice maximizes token duration while ensuring user continuity in your application.
Evaluate the confidentiality and availability needs of each application and configure the user pool app client to issue access tokens with an appropriate validity period. Custom token duration works best with longer-lived APIs and servers that can persistently manage the frequency of requests for credentials.