Skip to content

Commit

Permalink
config for deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
keryc Diaz committed Mar 21, 2019
1 parent 4cc7502 commit 2282d36
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 4 deletions.
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ define USAGE
Super awesome hand-crafted build system ⚙️

Commands:
init Install Python dependencies with pipenv
test Coming Soon (Run linters, test db migrations and tests.)
serve Run app in dev environment (localhost:3000).
init Install Python dependencies with pipenv
test Run linters, test db migrations and tests.
serve Run app in dev environment (localhost:3000).
invoke Invoke function with event.json as an input
new-bucket MY_BUCKET Create S3 bucket
package MY_BUCKET Package Lambda function and upload to S3
deploy MY_BUCKET Deploy SAM template as a CloudFormation stack
endef

export USAGE
Expand Down Expand Up @@ -32,4 +36,18 @@ serve: check-pipenv
pipenv run sam local start-api

invoke: check-pipenv
pipenv run sam local invoke WebHookFunction --event event.json
pipenv run sam local invoke WebHookFunction --event event.json

new-bucket:
aws s3 mb s3://$(filter-out $@,$(MAKECMDGOALS))

package:
sam package \
--output-template-file packaged.yaml \
--s3-bucket $(filter-out $@,$(MAKECMDGOALS))

deploy:
sam deploy \
--template-file packaged.yaml \
--stack-name botmakerd \
--capabilities CAPABILITY_IAM
54 changes: 54 additions & 0 deletions packaged.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: 'botmakerd
Sample SAM Template for botmakerd
'
Globals:
Function:
Timeout: 3
Resources:
WebHookFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://botmakerd.cuenca.io/c1df724bdae12c5ffc2b681798f5a127
Handler: app.lambda_handler
Runtime: python3.7
Events:
WebHook:
Type: Api
Properties:
Path: /webhook
Method: ANY
Policies:
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- dynamodb:PutItem
Resource:
Fn::Join:
- ''
- - 'arn:aws:dynamodb:'
- Ref: AWS::Region
- ':'
- Ref: AWS::AccountId
- :table/*
Outputs:
WebHookApi:
Description: API Gateway endpoint URL for Prod stage for WebHook function
Value:
Fn::Sub: https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/webhook/
WebHookFunction:
Description: WebHook Lambda Function ARN
Value:
Fn::GetAtt:
- WebHookFunction
- Arn
WebHookFunctionIamRole:
Description: Implicit IAM Role created for WebHook function
Value:
Fn::GetAtt:
- WebHookFunctionRole
- Arn

0 comments on commit 2282d36

Please sign in to comment.