I'm using AWS SAM (Serverless Application Model) to create a lambda with an API endpoint.
In my SAM template.yaml I have a getUser lambda with a /user endpoint.
template.yaml
Resources:
GetUser:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src
Handler: handler.getUser
Timeout: 300
Runtime: nodejs6.10
Events:
GetUser:
Type: Api
Properties:
Path: /user
Method: get
When I deploy this using AWS CLI it successfully creates the lambda and endpoint, but with an API Gateway Stage confusingly named "Stage". I want to change stage name to something else, like "Prod". How do I change stage name?
Here's where stage name is defined in the cloudformation template after it is deployed. I want "StageName": "Stage" to be something like "StageName": "Prod".
"ServerlessRestApiDeployment": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
"Ref": "ServerlessRestApi"
},
"StageName": "Stage"
}