Skip to content

Instantly share code, notes, and snippets.

@randika
Last active June 26, 2018 14:18
Show Gist options
  • Save randika/d26c72144123ea0bbbffa62fe3727aeb to your computer and use it in GitHub Desktop.
Save randika/d26c72144123ea0bbbffa62fe3727aeb to your computer and use it in GitHub Desktop.
service: alexa-home
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profiles.${self:provider.stage}}
region: us-east-1
environment:
DYNAMODB_TABLE_EXPENSES: ${self:service}-expenses-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE_EXPENSES}"
custom:
defaultStage: dev
profiles:
dev: serverless
prod: serverless
dynamodb:
start:
migrate: true
resources:
Resources:
DynamoDbTableExpenses:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: createdAt
AttributeType: N
KeySchema:
-
AttributeName: id
KeyType: HASH
-
AttributeName: createdAt
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE_EXPENSES}
functions:
addExpense:
handler: handler.handler
events:
- alexaSkill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment