Skip to content

Instantly share code, notes, and snippets.

@digitalbase
Last active April 22, 2020 19:48
Show Gist options
  • Save digitalbase/86b3b1b426257403a04797e8fdcc4c7d to your computer and use it in GitHub Desktop.
Save digitalbase/86b3b1b426257403a04797e8fdcc4c7d to your computer and use it in GitHub Desktop.
service: solving-marketing-attribution
custom:
# sma = Solving Marketing Attribution
tableIdentify: 'sma-identify-${self:provider.stage}'
tableTrack: 'sma-event-track-${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": ["SegmentIdentifyDynamoDBTable", "Arn" ] }
- { "Fn::GetAtt": ["SegmentTrackDynamoDBTable", "Arn" ] }
environment:
IDENTIFY_TABLE: ${self:custom.tableIdentify}
TRACK_TABLE: ${self:custom.tableTrack}
functions:
hello:
handler: index.handler
events:
- http: 'POST /events'
resources:
Resources:
SegmentIdentifyDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableIdentify}
SegmentTrackDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableTrack}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment