-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
101 lines (95 loc) · 2.44 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
service: ${env:APPLICATION}
plugins:
#- serverless-prune-plugin
- serverless-python-requirements
- serverless-dotenv-plugin
custom:
pythonRequirements:
dockerizePip: false
#prune:
# automatic: false
# number: 10
dotenv:
include:
- TZ_LOCAL
dynamoDbTable: data_pipeline_dynamodb_table
dynamoDbArn: !Join
- ''
- - 'arn:aws:dynamodb:'
- !Ref 'AWS::Region'
- ':'
- !Ref 'AWS::AccountId'
- ':table/'
- ${self:custom.dynamoDbTable}
provider:
name: aws
runtime: python3.7
memorySize: 256
timeout: 300
deploymentBucket:
name: load-2-dynamodb-deployment
maxPreviousDeploymentArtifacts: 1
stage: ${env:STAGE}
region: ${env:REGION}
versionFunctions: true
# you can add statements to the Lambda function's IAM Role here
iamRoleStatements:
- Effect: Allow
Action:
- s3:HeadObject
- s3:GetObject
Resource:
- arn:aws:s3:::load-2-dynamodb/*
- Effect: Allow
Action:
- s3:*
Resource:
- arn:aws:s3:::load-2-dynamodb-deployment/*
- Effect: Allow
Action:
- dynamodb:*
Resource:
- ${self:custom.dynamoDbArn}
# you can define service wide environment variables here
environment:
DYNAMO_TABLE: ${self:custom.dynamoDbTable}
# you can add packaging information here
package:
exclude:
- __cache__/**
- __pycache__/**
- node_modules/**
- 'package.json'
- 'package-lock.json'
functions:
dataPipeline:
handler: data_pipeline.run
name: my_first_data_pipeline
description: "jiang ren data pipeline demo"
events:
- s3:
bucket: load-2-dynamodb
event: s3:ObjectCreated:*
rules:
- prefix: csv/
- suffix: .csv
existing: true
# you can add CloudFormation resource templates here
resources:
Description: Jang Ren data pipeline services defination
Resources:
pipelineDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.dynamoDbTable}
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: date
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: date
KeyType: RANGE
BillingMode: PAY_PER_REQUEST