AWS Lambda (NET 6) & Cognito: How to use Swagger?

0

I am developing AWS Lambda (NET 6)=>RDS and use Cognito as Identity provider. I do not develop a client app because it will be done later. How to use Swagger to test Lambda using authentication? i.e. to use Cognito groups etc to test restriction on methods performing via Swagger?

3개 답변
1

Hi,

Given above info, if you need authentication and authorization mechanism with Lambda, you need to include a facade in front of: Api gateway or ALB as pointed out above.

In fact you cannot use lambda function urls, https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html, as they have IAM authentication only.

You could look into SAM https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html which supports provision of swagger in its template, which then you can test local, but you still will need that facade.

Hope it clarifies ;)

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

There are several options to access your Lambda. It could be deployed with a Function URL that can be called directly, or it can be fronted with an AWS Elastic Load Balancer (Application Load Balancer) or an API Gateway. Depending on how you set up your architecture, the configuration details change.

Do you mean to use Swagger UI to test your Lambda function, or to define a security scheme with Swagger (JSON/YAML)?

profile pictureAWS
답변함 일 년 전
0

I mean to test my Lambda using Swagger. I test my Lambda in Local environment: all methods etc and do it after deploying Lambda to AWS. It works fine, But now I need to add restrictions who can call methods (RBAC). I'll use Cognito. So the question: how to test the Lambda using Swagger + Cognito authentication + authorization. Customer can test the Lambda without client app and confirm it works correctly,

Oleg
답변함 일 년 전

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

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

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

관련 콘텐츠