Axwack
Axwack

Reputation: 569

How do you access an AWS Lambda with credentials using API Gateway?

I'm not clear on how to send credentials and IAM access to an API gateway. This seems clear: enter image description here

There is the tutorial on AWS but this is not the way I wanted to access my API. API Gateway example As most would know, you put your AWS Key and Secret key in a configuration file that lives in .AWS on the userspace of the user but if you are using a website, for example, you won't have that. Is the idea that anytime a user access the API that you put that user in an anonymous group that has access to the .credentials file?

Upvotes: 0

Views: 338

Answers (1)

KiteCoder
KiteCoder

Reputation: 2450

You are describing IAM authentication for API Gateways. For your of your web app to generate IAM credentials I would recommend using a Cognito Identity Pool Authenticated Role. The Cognito Identity Pool Authenticated Role Exchanges a JWT for the AWS IAM credentialsthat are used in API calls. Your users will first authenticate against the identity pool. The identity pool even allows for unauthenticated users that are using your registered app to generate credentials with permissions which you specify. This guide will show you how to generate these credentials in your code.

Alternatively you can use API Gateway Identity Pool Authorizer or API Gateway Lambda Authorizer to secure your API.

Upvotes: 1

Related Questions