Skip to content

Instantly share code, notes, and snippets.

@spg
Created December 2, 2017 19:21
Show Gist options
  • Save spg/a30a022fe7e1d68b2686b5b7cb4a1c3d to your computer and use it in GitHub Desktop.
Save spg/a30a022fe7e1d68b2686b5b7cb4a1c3d to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A serverless Gift Idea as a Service API
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: prod
DefinitionBody:
swagger: 2.0
info:
title:
Ref: AWS::StackName
paths:
"/gifts":
get:
x-amazon-apigateway-integration:
httpMethod: POST
type: aws_proxy
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyLambdaFunction.Arn}/invocations
responses: {}
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: python3.6
CodeUri: ./code
Events:
GetApi:
Type: Api
Properties:
Path: /gifts
Method: GET
RestApiId:
Ref: MyApi
Outputs:
GiftsEndpoint:
Value: !Sub 'https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/prod/gifts'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment