Dr. Marc
Dr. Marc

Reputation: 125

How can I authenticate AWS Lambda without an API Gateway?

I've got an iOS Shopping App and want to send crash dumps to an AWS Lambda Function.

To save costs for an API Gateway I want to send them directly to Lambda.

How can I authenticate the App and configure it so no other App can send crash dumps to my Lambda Function?

Upvotes: 0

Views: 452

Answers (2)

Othmane El Massari
Othmane El Massari

Reputation: 1

I'll tell you what i have do for a similar problem:

  • create an AWS user for the app, so the app has access to AWS_SECRET_KEY_ID and AWS_SECRET_ACCESS_KEY
  • In the app, (for safety) encrypt a crafted json with aws credentials using a KMS key for example
  • Invoke the lambda function with the encrypted payload as parameter, decrypt the payload and get user identity as following:
session = boto3.Session(
            aws_access_key_id=session['access_key'],
            aws_secret_access_key=session['secret_access_key'],
            aws_session_token=session['security_token']
        )
client = session.client('sts')
response = client.get_caller_identity()

Upvotes: 0

yuriy polonskiy
yuriy polonskiy

Reputation: 31

  1. AWS Cognito https://aws.amazon.com/cognito/
  2. Manually develop all the auth code. OAuth 2.0 with JWT tokens for example. In that case your Lambda can be executed by anyone (Bad idea), still you can limit concurrent executions.

Upvotes: 1

Related Questions