From 2cc94135686e6648e2c2bde4ea5cbb39eb49cfd3 Mon Sep 17 00:00:00 2001 From: Delong Yang Date: Wed, 9 Apr 2025 09:16:21 -0400 Subject: [PATCH] Add API key requirement --- template.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/template.yaml b/template.yaml index ed47b24..c02b7be 100644 --- a/template.yaml +++ b/template.yaml @@ -4,6 +4,12 @@ Description: > eks-automation-lambda Resources: + EKSAutomationApi: + Type: AWS::Serverless::Api + Properties: + StageName: Prod + Auth: + ApiKeyRequired: true # sets for all methods GitLambdaLayer: Type: AWS::Serverless::LayerVersion Properties: @@ -25,8 +31,11 @@ Resources: EKSAutomation: Type: Api Properties: + RestApiId: !Ref EKSAutomationApi Path: /EKSAutomation Method: get + Auth: + ApiKeyRequired: true Policies: - AWSLambdaVPCAccessExecutionRole - Statement: @@ -63,7 +72,7 @@ Resources: Outputs: EKSAutomationApi: Description: "API Gateway endpoint URL for Prod stage for EKS Automation function" - Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/automation/" + Value: !Sub "https://${EKSAutomationApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/automation/" EKSAutomationFunction: Description: "EKS Automation Lambda Function ARN" Value: !GetAtt EKSAutomationFunction.Arn