-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
102 lines (90 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
service: fg-api
# Pin service to only deploy with a specific Serverless version
frameworkVersion: '2'
# AWS config parameters
provider:
name: aws
runtime: python3.7
stackName: fotower-gallery
apiName: fotower-gallery
stage: dev
region: ap-southeast-2 # Sydney
apiGateway:
metrics: true
# Permissions
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:*
- s3:*
- cognito-idp:*
Resource: "*"
# Each function includes the files it needs
package:
exclude:
- apis/**
- env/**
- requirements.txt
individually: true
# Link to 4 files containing endpoint-specific functions
functions:
- '${file(apis/auth/auth.serverless.yml)}'
- '${file(apis/feed/feed.serverless.yml)}'
- '${file(apis/pictures/pictures.serverless.yml)}'
- '${file(apis/users/users.serverless.yml)}'
# CloudFormation instructions
resources:
# CloudFormation template syntax from here on.
Resources:
# DynamoDB required tables
usersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: fg-users-table
AttributeDefinitions:
- AttributeName: username
AttributeType: S
KeySchema:
- AttributeName: username
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
picturesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: fg-pictures-table
AttributeDefinitions:
- AttributeName: picId
AttributeType: S
KeySchema:
- AttributeName: picId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
# S3 image bucket
imagesBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: fg-images-bucket
# Cognito user pool
userPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: fg-user-pool
MfaConfiguration: OFF
Policies:
PasswordPolicy:
MinimumLength: 6
RequireUppercase: True
RequireNumbers: True
userPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
ClientName: fg-user-pool-client
UserPoolId:
Ref: userPool
ExplicitAuthFlows:
- ADMIN_NO_SRP_AUTH
GenerateSecret: false