-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
54 lines (50 loc) · 1.39 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
service: serverless-dynamodb
frameworkVersion: ">=1.1.0 <2.0.0"
provider:
name: aws
stage: ${self:custom.stage}
region: us-west-2
custom:
stage: ${opt:env}
config:
stg:
table_name: serverless-table-stg
read_capacity_units: 2
write_capacity_units: 2
prd:
table_name: serverless-table-prd
read_capacity_units: 5
write_capacity_units: 5
resources:
Resources:
DynamoDbTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.config.${self:custom.stage}.table_name}
AttributeDefinitions:
- AttributeName: UserId
AttributeType: S
- AttributeName: Game
AttributeType: S
KeySchema:
- AttributeName: UserId
KeyType: HASH
- AttributeName: Game
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: ${self:custom.config.${self:custom.stage}.read_capacity_units}
WriteCapacityUnits: ${self:custom.config.${self:custom.stage}.write_capacity_units}
Tags:
- Key: Name
Value: ${self:custom.config.${self:custom.stage}.table_name}
- Key: Environment
Value: ${self:custom.stage}
Outputs:
DynamoDBTableArn:
Description: DynamoDB ARN
Value:
Fn::GetAtt:
- DynamoDbTable
- Arn
Export:
Name: DynamoDBTableArn-${self:custom.stage}