Skip to content

Instantly share code, notes, and snippets.

@loloDawit
Created November 19, 2021 02:27
Show Gist options
  • Save loloDawit/b0df18f7c22e6047f3295fc3b52ab989 to your computer and use it in GitHub Desktop.
Save loloDawit/b0df18f7c22e6047f3295fc3b52ab989 to your computer and use it in GitHub Desktop.
Serverless config
service: newrelicservice
frameworkVersion: '2'
useDotenv: true
plugins:
- serverless-offline
- serverless-dotenv-plugin
- serverless-newrelic-lambda-layers
custom:
bucket: ${env:BUCKET_NAME}-${opt:stage}
# NewRelic
newRelic:
accountId: ${env:NEWRELIC_ACCOUNT_ID}
apikey: ${env:API_KEY}
debug: true
enableFunctionLogs: true
logEnabled: true
enableExtension: true
enableIntegration: true
cloudWatchFilter: "*"
provider:
name: aws
runtime: nodejs14.x
lambdaHashingVersion: 20201221
environment:
SLACK_SIGNING_SECRET: ${env:SLACK_SIGNING_SECRET}
SLACK_SIGNING_SECRET_PROD: ${env:SLACK_SIGNING_SECRET_PROD}
SLACK_BOT_TOKEN: ${env:SLACK_BOT_TOKEN}
SLACK_BOT_TOKEN_PROD: ${env:SLACK_BOT_TOKEN_PROD}
URL: ${env:URL}
API_KEY: ${env:API_KEY}
API_KEY_PROD: ${env:API_KEY_PROD}
BUCKET_NAME: ${env:BUCKET_NAME}
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Resource:
- "arn:aws:s3:::${self:custom.bucket}/*"
functions:
app:
handler: src/handler.app
events:
- http:
method: post
path: /slack/events
task:
handler: src/task.main
events:
- http:
path: task
method: post
cors: true
backup:
handler: src/backup.main
timeout: 120
events:
- http:
path: upload
method: post
cors: true
- schedule:
name: backupdashboards-${opt:stage}
description: 'Every Monday at 06:15 AM'
rate: cron(15 6 ? * MON *)
# Create our resources with separate CloudFormation templates
resources:
# S3
- ${file(s3-bucket.yml)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment