HIT_girl
HIT_girl

Reputation: 875

Boto3 library vs REST to invoke AWS lambda from python services

Are there reasons I shouldn't be using boto3 library in python to invoke my AWS Lambda and use REST instead?

Some background: I am evaluating lambdas for certain workflows triggered from my main webserver. The general setup I have is

I'm looking to introduce lambdas into the stack. It seems like I could use boto3 library to invoke my lambdas from my python services (either the main webserver app or the microservices). Are there any reasons boto3 would be a bad idea?

Upvotes: 1

Views: 872

Answers (1)

Marcin
Marcin

Reputation: 238867

The only way to directly invoke lambda is through Lambda Service. For that you have to use AWS CLI, SDK (e.g. boto3) or AWS Console. This requires to have valid IAM credentials with permissions for lambda invocation.

The indirect way of invoking lambda is through API Gateway with lambda proxy integration. This allows invoking lambda without IAM credentails, and is mostly useful for allow public access, e.g. in web browser.

Since you are writing that you want to invoke lambda from your backend server or conatiner:

I could use boto3 library to invoke my lambdas from my python services

using boto3 would be recommended way. The permissions for lambda invocation should be configured in instance or task roles.

Upvotes: 1

Related Questions