I have a Fastapi app that I have hosted on API Gateway using Serverless & gitlab CI/CD. I am trying to generate an API key and make all the endpoints private.
I am following the following links:
- https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#setting-api-keys-for-your-rest-api
- Set up API keys using the API Gateway console - Amazon API Gateway
The current serverless.yml
file I have:
provider:
name: aws
runtime: python3.7
stage: ${opt:stage, 'dev'}
region: ${env:AWS_DEFAULT_REGION}
lambdaHashingVersion: 20201221
endpointType: REGIONAL
apiGateway:
apiKeys:
- ${self:provider.stage}-pricesServiceKey
shouldStartNameWithService: true
functions:
my-lambda-fn:
handler: app.main.handler
timeout: 30
memorySize: 150
events:
- http: ANY /
private: true
- http: 'ANY /{proxy+}'
private: true
When I do this, I get the following error
The indentation seems to be absolutely correct. I have rechecked it.
What is the mistake that I am doing?