Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save digitalbase/1862d5694ddddab8819ad1088d3ec8d8 to your computer and use it in GitHub Desktop.
Save digitalbase/1862d5694ddddab8819ad1088d3ec8d8 to your computer and use it in GitHub Desktop.
service: ${env:SERVICE_NAME}
package:
exclude:
- data/**
- events/**
- .idea
plugins:
- serverless-offline
- serverless-dotenv-plugin
provider:
name: aws
runtime: nodejs10.x
stage: ${env:STAGE}
region: ${env:REGION}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:ListStreams
- lambda:InvokeFunction
Resource:
- { "Fn::GetAtt": ["SegmentIdentifiesDynamoDBTable", "Arn" ] }
- { "Fn::GetAtt": ["SegmentPageDynamoDBTable", "Arn" ] }
- { "Fn::GetAtt": ["SegmentAttributionDynamoDBTable", "Arn" ] }
- { "Fn::GetAtt": ["SegmentUserMappingDynamoDBTable", "Arn" ] }
functions:
- ${file(src/handlers/api/api.serverless.yml)}
# - ${file(src/handlers/debug/debug.serverless.yml)}
- ${file(src/handlers/process/process.serverless.yml)}
- ${file(src/handlers/segment/segment.serverless.yml)}
# - ${file(src/handlers/customerio/customerio.serverless.yml)}
resources:
Resources:
SegmentIdentifiesDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
StreamSpecification:
StreamViewType: NEW_IMAGE
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
BillingMode: PAY_PER_REQUEST
TableName: ${env:IDENTIFY_TABLE}
SegmentPageDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
StreamSpecification:
StreamViewType: NEW_IMAGE
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
BillingMode: PAY_PER_REQUEST
TableName: ${env:PAGE_TABLE}
SegmentAttributionDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: anonymousId
AttributeType: S
- AttributeName: eventId
AttributeType: S
KeySchema:
- AttributeName: anonymousId
KeyType: HASH
- AttributeName: eventId
KeyType: RANGE
BillingMode: PAY_PER_REQUEST
TableName: ${env:ATTRIBUTION_TABLE}
SegmentUserMappingDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
- AttributeName: anonymousId
AttributeType: S
KeySchema:
- AttributeName: userId
KeyType: HASH
- AttributeName: anonymousId
KeyType: RANGE
BillingMode: PAY_PER_REQUEST
TableName: ${env:USER_MAP_TABLE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment