Last active
July 6, 2020 02:53
-
-
Save davidkryzaniak/7f62589604f9d27f2331a7ad2f9d53ee to your computer and use it in GitHub Desktop.
Revisions
-
davidkryzaniak revised this gist
Jul 6, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,18 +25,20 @@ Resources: Timeout: 30 Events: HttpApiAnyPathAnyMethod: # Wildcard all Paths and Methods (does not include "/") Type: Api Properties: RestApiId: Ref: ApiGatewayEndpoint Path: /{proxy+} Method: any HttpApiSpecificPathAndMethod: # Request to /look/at/all/those/chickens/ must be a GET Type: Api Properties: RestApiId: Ref: ApiGatewayEndpoint Path: /look/at/all/those/chickens/ Method: get Outputs: -
davidkryzaniak created this gist
Jul 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Resources: # Build the API Gateway and setup an API Key ApiGatewayEndpoint: Type: 'AWS::Serverless::Api' Properties: StageName: Prod Auth: ApiKeyRequired: true UsagePlan: CreateUsagePlan: PER_API UsagePlanName: GatewayAuthorization # Setup the Lambda Function (You may want to change "ServerlessFunction" to something more meaningful) ServerlessFunction: Type: 'AWS::Serverless::Function' Properties: Runtime: nodejs12.x CodeUri: . Handler: index.handler Description: MemorySize: 128 Timeout: 30 Events: HttpApiAnyPathAnyMethod: Type: Api Properties: RestApiId: Ref: ApiGatewayEndpoint Path: /{proxy+} Method: any HttpApiSpecificPathAndMethod: Type: Api Properties: RestApiId: Ref: ApiGatewayEndpoint Path: / Method: get Outputs: ApiGateway: Description: "The URL is:" Value: !Sub "https://${ApiGatewayEndpoint}.execute-api.${AWS::Region}.amazonaws.com/Prod/" ApiKey: Description: "You can find your API Key in the AWS console: (Put in the request HEADER as 'x-api-key')" Value: !Sub "https://console.aws.amazon.com/apigateway/home?region=${AWS::Region}#/api-keys/${ApiGatewayEndpointApiKey}"