working with api gateway, lambda and cognito

0

i have an PYTHON lambda api and now i want to add authentication system beucase i want my users register and pay for my service. i know i can adapt cognito directly to api gateway but i want some changes.

1- i want my users can use my serves for a while(request count) 2- then i want to forward my users to authentication lambda to register and payment (it is another lambda function than my api) 3- i want to hold payment status and date on my user pool to track payment status

i can just use cognito boto3 sdk by my authentication lambda but i am not able to adapt it my main lambda api. you can share to me documents

thanks

3개 답변
0
수락된 답변

Based on my understanding of your question. you have two types of users

  1. Guest users (unauthenticated) - these users can access some of your services.
  2. Authenticated users - you need the user to authenticate before they pay for your services.

Cognito provide both unauthenticated and authenticated users. Moreover , Cognito can also switch the unauthenticated users to authenticated users with the same unique identifier. please check this for more details - https://docs.aws.amazon.com/cognito/latest/developerguide/switching-identities.html.

I would recommend to use Dynamo DB for payment status , you can use user unique id in Dynamo DB to map it with the users in user pool.

AWS
답변함 일 년 전
  • thanks. but i think i can hold payment status on cognito user pool. i will try it this later because i am in the beginning of the development. by the way i have an rds but also can hold a dynamodb for payment status

  • While you can have ways to store payment status in user pool but as a best practice you should keep payment information separate from user information. This helps to scale your application better.

0

Hi,

Have a read at this: https://repost.aws/knowledge-center/api-gateway-cognito-user-pool-authorizer as it covers and links to official guides about setting it up.

Finally this is more a comprehensive guide with tutorials and hands on workshops. https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-tutorials.html

Hope it helps ;)

profile picture
전문가
답변함 일 년 전
0

API Gateway and Cognito do not provide a way for doing what you want. Further more, as you want to be able to give your uses some number of free APIs, you need to know who they are.

I would recommend that you use Cognito for user registration and authentication, API Gateway for enforcing the credentials and the Lambda function to implement the business logic, that will include also counting calls and saving the information to Dynamo DB, which then can be used for charging.

profile pictureAWS
전문가
Uri
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠