Cognito
AWS Cognito ノート。
Overview
Web またはモバイルアプリケーションと対話 するための ID をユーザーに提供 。

User Pool
Features
- アプリと Web 用 のサーバーレスデータベースを作成
- ログイン: ユーザー名 /メール & パスワードの組 み合 わせ
- パスワードリセット
- メール & 電話番号 認証
- 多要素 認証 (MFA)
- フェデレーション ID: Facebook、Google、SAML からのユーザー
Integration
API Gateway & Application Load Balancer と統合

Identity Pool (Federated Identities)
- ユーザーが AWS リソースに直接 アクセスできるよう AWS 認証 情報 を提供
- Cognito User Pools を ID プロバイダーとして統合

Row Level Security in DynamoDB
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["dynamodb:GetItem", "..."],
"Resource": ["arn:aws:dynamodb:us-west-2:123456789012:table/MyTable"],
"Condition": {
"ForAllValues:StringEquals": {
"dynamodb:LeadingKeys": ["${cognito-identity.amazonaws.com:sub}"]
}
}
}]
}AWS JWT Token
Header
{
"kid": "key-id-123456",
"alg": "RS256",
"typ": "JWT"
}Payload
{
"sub": "user-uuid-123456",
"cognito:groups": ["your_user_pool_id_Google"],
"iss": "https://cognito-idp.your_region.amazonaws.com/your_user_pool_id",
"version": 2,
"client_id": "aws-123456-aws-use-client-id-replace-aud",
"token_use": "access",
"scope": "openid profile email",
"auth_time": 1672545600,
"exp": 1735617600,
"iat": 1672545600,
"jti": "token-unique-identifier-123456",
"username": "google_106955291718272375458"
}