-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
117 lines (107 loc) · 4.47 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# See AWS GO MOD section at this link for how this project was created..
# https://www.serverless.com/framework/docs/providers/aws/examples/hello-world/go/
# sls create --template aws-go-mod --path GoConchRepublicBackEnd
# For full config options, check the docs:
# https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
service: goconchrepublic
# 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: "=X.X.X"
frameworkVersion: '>=2.0.0'
# A custom variables section for centralizing things (e.g. Environmental Variables, etc.) that need to be referenced
# across modules
custom:
projectName: ConchRepublic
sqsTopic: https://sqs.us-east-1.amazonaws.com/${env:AWS_ACCOUNT}/FloridaKeysDBInsert
snsTopic: arn:aws:sns:us-east-1:${env:AWS_ACCOUNT}:FloridaKeysTableUpdate
urlBase1: "https://fla-keys.com"
urlBase2: "/calendar/all/florida-keys/"
dynamoDBTable: "FloridaKeysEventsTest"
provider:
tracing:
apiGateway: true
lambda: true
name: aws
tags:
PROJECT_NAME: ${self:custom.projectName}
runtime: go1.x
# Set the default stage used. Default is dev
stage: "dev"
# Overwrite the default region used. Default is us-east-1
region: "us-east-1"
# The default is 6 seconds. Note: API Gateway current maximum is 30 seconds
#timeout: 10
logRetentionInDays: 30 # Set the default RetentionInDays for a CloudWatch LogGroup
versionFunctions: false #if each different deploy needs to be long term retained, then set to true
# you can ADD statements to the Lambda function's IAM Role (iamRoleStatements) here
memorySize: 512 # will be inherited by all functions
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: arn:aws:dynamodb:us-east-1:${env:AWS_ACCOUNT}:table/FloridaKeys*
- Effect: "Allow"
Action:
- "sqs:*"
Resource: arn:aws:sqs:us-east-1:${env:AWS_ACCOUNT}:FloridaKeys*
- Effect: "Allow"
Action:
- "sns:Publish"
Resource: arn:aws:sns:*:${env:AWS_ACCOUNT}:FloridaKeys*
#BY DEFAULT, these logging group/events role statements come built-in
# - Effect: "Allow"
# Action:
# - "logs:CreateLogStream"
# - "logs:CreateLogGroup"
# - "logs:PutLogEvents"
# you can define service wide environment variables here
#environment:
package:
exclude:
- ./**
include:
- ./bin/fetch
- ./bin/database
functions:
fetch:
handler: bin/fetch
timeout: 30
# Function level environment variables
environment:
URLBASE: ${self:custom.urlBase1}
URLBASE2: ${self:custom.urlBase2}
SQS_TOPIC: ${self:custom.sqsTopic}
SNS_TOPIC: ${self:custom.snsTopic}
# Moving the launch of both Fetch and Database into an AWS Step Function, with its own CRON EventBridge launch
# events:
# - eventBridge:
# # You can have a separate eventBus (instead of Default) if needed
# schedule: cron(0 22 ? * MON-FRI *) #run at 23:00 UTC time Monday through Friday
database:
handler: bin/database
timeout: 60 #note, this value can't be more than 30 seconds IF also having http event (api gateway) as part of triggers
# Function level environment variables
environment:
DYNAMO_DB_TABLENAME: ${self:custom.dynamoDBTable}
SNS_TOPIC: ${self:custom.snsTopic}
SQS_TOPIC: ${self:custom.sqsTopic}
# Moving the launch of both Fetch and Database into an AWS Step Function, with its own CRON EventBridge launch
# events:
# - eventBridge:
# # You can have a separate eventBus (instead of Default) if needed
# # eventBus: 'arn:aws:events:us-east-1:619676567607:event-bus/conchrepublic'
# # To have eventBridge run this function according to a schedule, or be cron kicked off, use rate or cron
# #see https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions
# #schedule: rate(5 minutes)
# #NOTE!! schedule ONLY works as a rule on the default event bus
# #NOTE!! cron time uses UTC time, which may be different than your time, so adjust HOUR parm accordingly
# #so job kicks off at the right time (local time)
# schedule: cron(0/10 22-23 ? * MON-FRI *) #run Mon-Fri starting at 22:10 UTC