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 Risposte
0
Risposta accettata

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
con risposta un anno fa
  • 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
ESPERTO
con risposta un anno fa
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
ESPERTO
Uri
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande