Function_Name:
handler: function path
events:
- http:
path: path/{id}
method: get
I want to add apikey required for that function, how should I do? I don't want to make it manually from aws.Thanks!
Function_Name:
handler: function path
events:
- http:
path: path/{id}
method: get
I want to add apikey required for that function, how should I do? I don't want to make it manually from aws.Thanks!
Serverless Framework has option to add apiKeys under provider section at serverless.yml. Find example code below for your reference.
service: demo-api-key
provider:
name: aws
runtime: nodejs12.x
apiKeys:
- "demo-apikey"
functions:
hello:
handler: handler.hello
events:
- http:
path: hello
method: get
message:
handler: private.message
events:
- http:
path: message
method: get
private: true
or else checkout this plugin for alternative way.