I have a cloudformation template that generates an API. I want one of the endpoints to have a path parameter. However, I don't understand how I can achieve this with AWS::Serverless::Function
. Here is my current function:
GetItems:
Type: AWS::Serverless::Function
Properties:
Handler: api/items/get.handler
Timeout: 29
CodeUri: .
Events:
Get:
Type: Api
Properties:
Method: get
Path: /items
RestApiId: !Ref MyAPI
This creates an endpoint like aws-domain-example.com/v1/items
. This works just fine.
However, I want aws-domain-example.com/v1/items/{item_id}
How can I add a path parameter?