Created
April 25, 2020 08:44
-
-
Save digitalbase/97d6d70749569e897ff0a728cf087c7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: solving-marketing-attribution | |
custom: | |
# sma = Solving Marketing Attribution | |
tableIdentify: 'sma-identify-${self:provider.stage}' | |
tablePage: 'sma-event-page-${self:provider.stage}' | |
tableAttribution: 'sma-event-attribution-${self:provider.stage}' | |
tableUserMapping: 'sma-event-user-map-${self:provider.stage}' | |
provider: | |
name: aws | |
runtime: nodejs10.x | |
stage: dev | |
region: eu-west-1 | |
iamRoleStatements: | |
- Effect: Allow | |
Action: | |
- dynamodb:Query | |
- dynamodb:Scan | |
- dynamodb:GetItem | |
- dynamodb:PutItem | |
- dynamodb:UpdateItem | |
- dynamodb:DeleteItem | |
- dynamodb:ListStreams | |
Resource: | |
- { "Fn::GetAtt": ["SegmentIdentifiesDynamoDBTable", "Arn" ] } | |
- { "Fn::GetAtt": ["SegmentPageDynamoDBTable", "Arn" ] } | |
- { "Fn::GetAtt": ["SegmentAttributionDynamoDBTable", "Arn" ] } | |
- { "Fn::GetAtt": ["SegmentUserMappingDynamoDBTable", "Arn" ] } | |
environment: | |
IDENTIFY_TABLE: ${self:custom.tableIdentify} | |
PAGE_TABLE: ${self:custom.tablePage} | |
ATTRIBUTION_TABLE: ${self:custom.tableAttribution} | |
USER_MAP_TABLE: ${self:custom.tableUserMapping} | |
functions: | |
hello: | |
handler: index.handler | |
events: | |
- http: 'POST /events' | |
processPage: | |
handler: processPage.handler | |
events: | |
- stream: | |
type: dynamodb | |
batchSize: 1 | |
startingPosition: LATEST | |
arn: | |
Fn::GetAtt: | |
- SegmentPageDynamoDBTable | |
- StreamArn | |
processIdentify: | |
handler: processIdentify.handler | |
events: | |
- stream: | |
type: dynamodb | |
batchSize: 1 | |
startingPosition: LATEST | |
arn: | |
Fn::GetAtt: | |
- SegmentIdentifiesDynamoDBTable | |
- StreamArn | |
getAnonymous: | |
handler: src/handlers/api/getAnonymous.handler | |
events: | |
- http: get /api/anonymous/{id} | |
getUser: | |
handler: src/handlers/api/getUser.handler | |
events: | |
- http: get /api/user/{id} | |
resources: | |
Resources: | |
SegmentIdentifiesDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
StreamSpecification: | |
StreamViewType: NEW_IMAGE | |
AttributeDefinitions: | |
- AttributeName: messageId | |
AttributeType: S | |
KeySchema: | |
- AttributeName: messageId | |
KeyType: HASH | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
TableName: ${self:custom.tableIdentify} | |
SegmentPageDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
StreamSpecification: | |
StreamViewType: NEW_IMAGE | |
AttributeDefinitions: | |
- AttributeName: messageId | |
AttributeType: S | |
KeySchema: | |
- AttributeName: messageId | |
KeyType: HASH | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
TableName: ${self:custom.tablePage} | |
SegmentAttributionDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: anonymousId | |
AttributeType: S | |
- AttributeName: eventId | |
AttributeType: S | |
KeySchema: | |
- AttributeName: anonymousId | |
KeyType: HASH | |
- AttributeName: eventId | |
KeyType: RANGE | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
TableName: ${self:custom.tableAttribution} | |
SegmentUserMappingDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: userId | |
AttributeType: S | |
- AttributeName: anonymousId | |
AttributeType: S | |
KeySchema: | |
- AttributeName: userId | |
KeyType: HASH | |
- AttributeName: anonymousId | |
KeyType: RANGE | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
TableName: ${self:custom.tableUserMapping} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment