Created
September 12, 2017 15:41
-
-
Save KylePalko/9aff9c2289ac296adec65e64ff9b3b61 to your computer and use it in GitHub Desktop.
An example CloudFormation Template for Lambda/API Gateway
This file contains 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 characters
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