-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
78 lines (72 loc) · 2.35 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
service: ${env:CONTEXT}
# enables sqs as DLQ for lambdas
plugins:
- serverless-plugin-lambda-dead-letter
- serverless-plugin-dynamodb-autoscaling
custom:
context: ${env:CONTEXT}
service: ${env:SERVICE}
environment: ${env:ENVIRONMENT}
aws_accountid: ${env:AWS_ACCOUNTID}
deployment_bucket: ${env:SERVERLESS_DEPLOYMENT_BUCKET}
lambda_name: ${env:CONTEXT}-${env:SERVICE}-${env:ENVIRONMENT}
DynamoDBTableName: ${env:CONTEXT}-mybigddbtable-${env:ENVIRONMENT}
# delete next section, if DynamoDB autoscaling is not required
dynamodbAutoscaling:
iamRoleArn: arn:aws:iam::${self:custom.aws_accountid}:role/devops/${self:custom.context}-${self:custom.environment}-infrastructure
tablesConfig:
DynamoDbTable1:
minCapacity: 2
maxCapacity: 5
provider:
name: aws
runtime: python3.6
region: eu-west-1
stage: ${opt:stage, 'staging'}
deploymentBucket:
name: ${self:custom.deployment_bucket}
serverSideEncryption: AES256
tags:
context: ${self:custom.context}
service: ${self:custom.service}
stack: ${self:custom.environment}
role: arn:aws:iam::${self:custom.aws_accountid}:role/context/${self:custom.context}-${self:custom.environment}
functions:
lambdafunction1:
name: ${self:custom.lambda_name}
handler: lambda.handler
description: <add description here>
memorySize: 128
timeout: 10
reservedConcurrency: 5
deadLetter:
sqs: ${self:custom.context}-${self:custom.service}deadletter-${self:custom.environment}
environment:
varA: varA
events:
- schedule:
name: ${self:custom.lambda_name}-schedule
description: ${self:custom.lambda_name} runs every 5 minutes
rate: rate(5 minutes)
resources:
Resources:
DynamoDbTable1:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.DynamoDBTableName}
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
KeySchema:
- AttributeName: userId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Tags:
- Key: context
Value: ${self:custom.context}
- Key: service
Value: ${self:custom.service}
- Key: stack
Value: ${self:custom.environment}