Skip to content

Instantly share code, notes, and snippets.

@sonjisov
Created May 29, 2019 08:40
Show Gist options
  • Save sonjisov/5b34fcbc2dc6f0949560fb2439f071ca to your computer and use it in GitHub Desktop.
Save sonjisov/5b34fcbc2dc6f0949560fb2439f071ca to your computer and use it in GitHub Desktop.
service: wick-quotes
provider:
name: aws
runtime: nodejs8.10
stage: dev
environment:
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
Resource: "*"
# Here we have one function subscribed to a DynamoDB stream
functions:
quoteJohnWick:
handler: handler.quoteJohnWick
events:
- stream:
type: dynamodb
arn: Fn::GetAtt: [JohnWickQuotes, StreamArn]
resources:
Resources:
JohnWickQuotesDynamoDbTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: "author"
AttributeType: "S"
KeySchema:
-
AttributeName: "author"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification: # This will not be restored from a native backup
StreamViewType: "NEW_AND_OLD_IMAGES"
TimeToLiveSpecification: # Same here
AttributeName: ttl
Enabled: true
TableName: "JohnWickQuotes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment