My problem
I have the basic hello world function deployed at the https://<something>.execute-api.eu-central-1.amazonaws.com/dev
.
I would like to have the same function deployed in my own subdomain, say m/-sub.domain.com
. The subdomain is defined in Route53, but I did not find a straightforward way to map it to the lambda function using serverless
.
What have I tried
I’ve Googled quite a bit and tried some solutions (especially this one), by adding the following:
environment:
DomainName: <my-sub.domain.com>
stageName: whatever # What does this mean?
resources:
Resources:
pathmapping:
Type: AWS::ApiGateway::BasePathMapping
Properties:
BasePath: oauth2
DomainName: ${self:vars.domainName}
RestApiId:
Ref: ApiGatewayRestApi
Stage: ${self:vars.stage}
But ended up with:
Serverless Warning --------------------------------------
A valid service attribute to satisfy the declaration 'self:vars.domainName' could not be found.
Serverless Warning --------------------------------------
A valid service attribute to satisfy the declaration 'self:vars.stage' could not be found.
I am not sure what is the stage
variable, and why is the domainName
unreadable by the deployment tool.
Appreciate any help,
Adam