For anyone else who finds this, note there’s some confusion here about API gateway resources.
-
The
RestApiIdis the id of the API resource itself, which is returned by aRefof the impliedApiGatewayRestApiresource that Serverless creates under the hood. -
The
RootResourceIdis the id of the REST resource (not to be confused with a CloudFormation resource!) at the root of the API’s path (i.e. “/”). If you are hanging methods or subresources off of root, you’ll need to provide this as the parent resource id. It is available as an attribute of the API resource.
So, for example to define a resource at the path “/mythings”, which needs both the api id and the root resource id, your CF template would look like
ThingsResource:
Type: AWS::ApiGateway::Resource
Properties:
RestApiId:
Ref: ApiGatewayRestApi
ParentId:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
PathPart: mythings
Hope this helps clarify.