-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserverless.yml
More file actions
86 lines (81 loc) · 2.02 KB
/
serverless.yml
File metadata and controls
86 lines (81 loc) · 2.02 KB
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
service: "aws-lambda-django" # <name> of the service
provider:
name: aws
runtime: python3.11
stage: prod
region: us-west-2
deploymentBucket:
name: infra.opszero.com
environment:
DYNAMODB_TABLE_NAME: ${self:service}-${sls:stage}
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:*
Resource:
Fn::GetAtt:
- oneTable
- Arn
# - Effect: "Allow"
# Action:
# - s3:*
# Resource:
# Fn::Join:
# - ""
# - - "arn:aws:s3:::"
# - "Ref" : "setupname"
# - '/*'
functions:
api:
url:
cors: true
timeout: 29
memorySize: 128
handler: mrwork/asgi.handler
# warm_up:
# handler: app.warn_up
# timeout: 300
# memorySize: 512
# events:
# - schedule: cron(0/5 * ? * * *)
# environment:
# BASE_URL: { "Fn::Join" : ["", [" https://", { "Ref" : "ApiGatewayRestApi" }, ".execute-api.${self:custom.region}.amazonaws.com/${self:custom.stage}" ] ] }
plugins:
- serverless-python-requirements
custom:
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
pythonRequirements:
dockerizePip: true
dockerImage: python:3.10
usePoetry: true
package:
patterns:
- '!node_modules/**'
resources:
Resources:
oneTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-${sls:stage}
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: sk
KeyType: RANGE
# ProvisionedThroughput:
# ReadCapacityUnits: 1
# WriteCapacityUnits: 1
BillingMode: PAY_PER_REQUEST
# s3bucket:
# Type: AWS::S3::Bucket
# Properties:
# BucketName: setupname
# AccessControl: PublicRead
# WebsiteConfiguration:
# IndexDocument: index.html