Amazon Cognito is a CIAM service that supports managing user authentication and authorization to enable secure access to APIs and workloads.
It offers support for OAuth 2.0 client credentials grants used for M2M authorization.
It is suggested to locally cache and reuse access tokens, and customize the valid token period to align with security requirements.
M2M use cases can be combined with a REST API proxy integration using Amazon API Gateway enables to cache token responses and optimize request and response of access tokens.
Monitoring usage and costs can be done using the Security tab of the Cost and Usage Dashboards Operations Solution.
Token caching from Amazon API Gateway can be used to reduce token requests and improve latency.
It's important to use AWS Secrets Manager to retrieve credentials for authentication only at runtime rather than hard-code credentials into workloads and applications.
It's suggested to use AWS WAF to protect user pool endpoints from unwanted HTTP web requests.
Several security best practices and considerations were discussed, such as using AWS WAF, always verifying tokens, defining scopes at the app client level.
API cache encryption can be enabled to meet security requirements.