Reputation: 3055
I'm using AWS SAM.
From the docs, I see "Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default."
But when I try:
Resources:
ExpressApi:
Type: AWS::Serverless::Api
Properties:
StageName: '$default'
The stack create fails with message:
Stage name only allows a-zA-Z0-9_
I just want to be able to use the API base URL without the StageName in the path. My API has only one stage.
Is there a way to do that without hooking up a custom domain to the API?
Upvotes: 2
Views: 2200
Reputation: 10393
For HTTP API:
StageName is optional as HTTP API creates $default
stage by default which can be accessed without any prefix and auto deployes.
If no name is specified, AWS SAM uses the $default stage from API Gateway
For REST API
StageName is required. There is no auto deploy for Rest APIs. SAM Template behind the scenes it creates that stage and deploy code to that stage and it allows only a-zA-Z0-9_
Upvotes: 2