serverless.yml
# For full config options, check the docs:
# docs.serverless.com
# https://www.serverless.com/framework/docs/
# https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
service: py-fx
# app and org for use with dashboard.serverless.com
#app: your-app-name
#org: your-org-name
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
frameworkVersion: '3'
plugins:
- serverless-api-gateway-throttling
useDotenv: true
custom:
prefix: ${self:service}-${self:provider.stage}
# INFO: plugin - serverless-api-gateway-throttling
apiGatewayThrottling:
maxRequestsPerSecond: 10
maxConcurrentRequests: 5
provider:
apiGateway:
shouldStartNameWithService: true
# Optional usage plan configuration
usagePlan:
quota:
limit: 30
offset: 0 # ApiGatewayUsagePlan - Usage Plan quota offset must be zero in the DAY period
period: DAY
throttle:
burstLimit: 20
rateLimit: 10
endpointType: regional
logRetentionInDays: 30
memorySize: 512
name: aws
region: us-east-2
# INFO: refer to iamRoleStatements
# なるべくserverless frameworkのみで完結できるよう、使用するroleはiamRoleStatementsで定義した
# role: arn:aws:iam::${env:AWS_ACCOUNT_ID}:role/service-role/lambda_for_trade
runtime: python3.9
stage: ${opt:stage, 'dev'}
timeout: 20
versionFunctions: false
# you can add statements to the Lambda function's IAM Role here
iam:
role:
statements: ${file(./serverless_resources/iam.yml)}
# you can add packaging information here
package:
patterns:
- '!./**'
- 'src/**'
- 'tools/**'
# artifact: tmp/zips/app/fx_archive.zip
# Create an individual zip-file for each function
# individually: true # default is `false`
# INFO: 'excludeDevDependencies: true' => ignore modules in package.json devDependencies
excludeDevDependencies: false
functions:
AutoTrade: ${file(./serverless_resources/functions/auto_trade.yml)}
Tradehist: ${file(./serverless_resources/functions/tradehist.yml)}
IndicatorNames: ${file(./serverless_resources/functions/indicator_names.yml)}
resources:
# - Resources:
# # INFO: comment in if `disableLogs: true` in function is specified
# TradehistLogGroup:
# Type: AWS::Logs::LogGroup
# Properties:
# LogGroupName: /aws/lambda/${self:custom.prefix}
# RetentionInDays: 30
# NOTE: DynamoDB Table
- ${file(./serverless_resources/dynamodb.yml)}
# NOTE: SNS sending Email
- ${file(./serverless_resources/sns.yml)}
# NOTE: Cloudwatch Alarm
- ${file(./serverless_resources/alarm.yml)}