- Newest
- Most votes
- Most comments
This can indeed be done as specified in this documentation. Should you use the following resource
arn:aws:execute-api:region:account-id:api-id/stage-name/*/foo/bar/*
the policy will apply to all methods under sub-resources of /foo/bar/. For example, an allow there in authorizer policy will not allow methods under /foo, only for sub-resources under /foo/bar/.
Using a wildcard * for the http verb segment won't have an impact on later resource segment unless it is the last segment. Only the * in last segment in this example will match everything to right. Do refer to example resource expressions here for details.
Is there a way to provide a wildcard that matches only a single path element? For example, I would like to allow access to /user/{userId} (for all values of userId), but NOT access to /user/{userId}/sensitive.
unfortunately: arn:aws:execute-api:region:account-id:api-id/stage-name/GET/user/*
seems to also allow: arn:aws:execute-api:region:account-id:api-id/stage-name/GET/user/*/sensitive
I would like to be able to authorize my users with explicit allows for specific endpoints (including REST paths with path variables matching either any value of the variable or specific values) and implicit denies for any endpoints not explicitly identified in the policy.
AWS PLEASE make a wildcard for resources that matches only a single path element.

Okay, thanks! So, per the examples, it looks like in the format
arn:aws:execute-api:region:account-id:api-id/stage-name/HTTP-VERB/resource-path-specifierit is possible to use a wildcard in place ofstage-nameand/orHTTP-VERBand still specifyresource-path-specifierwhich may also include a wildcard at the end.Is it possible, then, to also use multiple wildcards in the
resource-path-specifier? For example, could I use a wildcard to match a path variable in my API Gateway resource - e.g./foo/bar/*/allowedwould allow access to/foo/bar/{id}/allowedbut deny access to any other sub-resource of/foo/bar/{id}/?/foo/bar/*/allowedshould work as you expect, allowingallowedsub-resource but implicitly denying other sub-resources