# m2m-authentication

Published articles for m2m-authentication.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Caching Cognito M2M Tokens With Lambda, DynamoDB, and WAF

DevFeed: [Caching Cognito M2M Tokens With Lambda, DynamoDB, and WAF](<https://devfeed.tech/articles/caching-cognito-m2m-tokens-with-lambda-dynamodb-and-waf-59663.md>)

Original publisher: [Read original article](<https://hackernoon.com/caching-cognito-m2m-tokens-with-lambda-dynamodb-and-waf?source=rss>)

Author: Lucas Tonelli

Published: 2026-09-24T17:00:19Z

Content type: tutorial

Language: en

Sources: [HackerNoon](<https://devfeed.tech/sources/hackernoon.md>)

Topics: [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [OAuth 2.0](<https://devfeed.tech/topics/oauth2.md>), [Amazon API Gateway](<https://devfeed.tech/topics/amazon-api-gateway.md>)

Tags: [access-token-caching](<https://devfeed.tech/tags/access-token-caching.md>), [api-gateway](<https://devfeed.tech/tags/api-gateway.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-cognito](<https://devfeed.tech/tags/aws-cognito.md>), [aws-cost-optimization](<https://devfeed.tech/tags/aws-cost-optimization.md>), [aws-lambda](<https://devfeed.tech/tags/aws-lambda.md>), [aws-waf](<https://devfeed.tech/tags/aws-waf.md>), [caching](<https://devfeed.tech/tags/caching.md>), [costs](<https://devfeed.tech/tags/costs.md>), [dynamodb](<https://devfeed.tech/tags/dynamodb.md>), [dynamodb-ttl](<https://devfeed.tech/tags/dynamodb-ttl.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [m2m-authentication](<https://devfeed.tech/tags/m2m-authentication.md>), [oauth](<https://devfeed.tech/tags/oauth.md>), [oauth-2-0](<https://devfeed.tech/tags/oauth-2-0.md>), [oauth2-client-credentials](<https://devfeed.tech/tags/oauth2-client-credentials.md>), [tokens](<https://devfeed.tech/tags/tokens.md>), [waf](<https://devfeed.tech/tags/waf.md>)

### AI overview

The tutorial describes placing a Lambda function between services and Amazon Cognito to cache machine-to-machine OAuth 2.0 access tokens in DynamoDB. It explains how expiry checks, TTL, scope-aware keys, and AWS WAF can reduce repeated token requests and related costs.

### Source excerpt

A Lambda in front of Cognito's token endpoint caches tokens in DynamoDB, reducing the number of requests to Cognito and saving money. By adding AWS WAF to block direct requests to Cognito, the solution ensures that all requests go through the Lambda, further reducing costs.