Skip to content

Is It possible to sequence the creation of permissions for a Lambda with multiple API endpoints in a SAM template? #3306

Discussion options

You must be logged in to vote

I'm not sure there's a way to add "DependsOn" to the LambdaPermission resources that SAM generates, but I think there are two solutions available here without forcing you to make drastic code changes.

  1. Use a {proxy} or {proxy+} greedy path, which sounds like it's essentially what you're doing anyway, to route all API Gateway routes to one function. So as far as API Gateway is concerned, this is one integration and one endpoint and one Lambda Permission.
  2. Create multiple Lambda functions all pointing to the same Node handler module, one for each endpoint, or group them in some way, e.g. UserFunction handles /user/.... paths

Replies: 4 comments 17 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@mmcglone
Comment options

@kaihendry
Comment options

@mmcglone
Comment options

@kaihendry
Comment options

@mmcglone
Comment options

Comment options

You must be logged in to vote
2 replies
@mmcglone
Comment options

@awood45
Comment options

Answer selected by mmcglone
Comment options

You must be logged in to vote
8 replies
@awood45
Comment options

@mmcglone
Comment options

@awood45
Comment options

@theburningmonk
Comment options

@mmcglone
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants