Lambda cross account

0

Hi, I have an API gateway that has as authorizer a lambda function in another account. To authorize the cross-account lambda function I used the "aws lambda add-permission ..." procedure following the instructions given here https://aws.amazon.com/it/blogs/compute/centralizing-security-with-amazon -api-gateway-and-cross-account-aws-lambda-authorizers/ but it is a manual operation. Is it possible to perform the same operation via aws sdk v2? Or is there an alternative way to do this automatically during deployment? Thanks!

asked 7 months ago215 views
1 Answer
-1

Hi,

the right to do such a configuration automatically is via CloudFormation.

You have sample code for API Gateway with Lambda Authorizer here : https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-controlling-access-to-apis-lambda-authorizer.html

Your goal is very right: you should never do such setups manually but always go for automation. The only use of the console is when you discover the service and its architecture.

CloudFormation may represent some initial investment but you save so much time when you get the right skills with it! (As you can see, I am a big fan of it...)

Best

Didier

profile pictureAWS
EXPERT
answered 7 months ago
  • Thanks, but the example you wrote is not the answer to my question. In my case Api Gateway and the authorization function are in different accounts; while in yours they are in the same account. And I would like to use not cloud formation directly but aws sdk v2.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions