Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KylePalko/9aff9c2289ac296adec65e64ff9b3b61 to your computer and use it in GitHub Desktop.
Save KylePalko/9aff9c2289ac296adec65e64ff9b3b61 to your computer and use it in GitHub Desktop.
An example CloudFormation Template for Lambda/API Gateway
Resources:
AccountsRestApi:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "AccountsRestApi"
FailOnWarnings: "true"
AccountsResource:
Type: "AWS::ApiGateway::Resource"
Properties:
ParentId:
Fn::GetAtt:
- "AccountsRestApi"
- "RootResourceId"
PathPart: "accounts"
RestApiId:
Ref: AccountsRestApi
CreateAccountMethod:
Type: "AWS::ApiGateway::Method"
Properties:
HttpMethod: "GET"
AuthorizationType: "NONE"
ResourceId:
Ref: AccountsResource
RestApiId:
Ref: AccountsRestApi
Integration:
Type: "AWS"
Uri:
Fn::Join:
- ""
- - "arn:aws:apigateway:"
- !Ref "AWS::Region"
- ":lambda:path/"
- "/2015-03-31/functions/"
- Fn::GetAtt:
- CreateAccountLambdaFunction
- Arn
- "/invocations"
IntegrationHttpMethod: "GET"
CreateAccountLambdaFunction:
Type: "AWS::Lambda::Function"
Properties:
FunctionName: createAccount
Code:
S3Bucket: <deployment-bucket>
S3Key: <lambda-code.zip>
Handler: endpoints/createAccount/index.handler
Role: <lambda-role>
Runtime: nodejs6.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment