Skip to content

Instantly share code, notes, and snippets.

@alexxxmf
Created May 27, 2019 12:50
Show Gist options
  • Save alexxxmf/bd6626957e53bcc969427b0e113c12c7 to your computer and use it in GitHub Desktop.
Save alexxxmf/bd6626957e53bcc969427b0e113c12c7 to your computer and use it in GitHub Desktop.
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy Coding!
service: recipe-serverless-backend # NOTE: update this with your service name
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
provider:
name: aws
runtime: nodejs8.10
region: eu-west-1
environment:
KETO_RECIPES: ${self:service}-keto-recipes
KETO_RECIPE_DETAILS: ${self:service}-keto-recipe-details
KETO_RECIPE_COMMENTS: ${self:service}-keto-recipe-comments
KETO_RECIPE_RATINGS: ${self:service}-keto-recipe-ratings
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
- "dynamodb:UpdateItem"
- "dynamodb:PutItem"
- "dynamodb:Scan"
- "dynamodb:Query"
- "dynamodb:DeleteItem"
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:*"
functions:
graphql:
handler: handler.graphql
events:
- http:
path: graphql
method: post
cors: true
integration: lambda-proxy
- http:
path: graphql
method: get
cors: true
integration: lambda-proxy
resources:
Resources:
ketoRecipesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.KETO_RECIPES}
AttributeDefinitions:
- AttributeName: recipeId
AttributeType: N
KeySchema:
- AttributeName: recipeId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ketoRecipeDetails:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.KETO_RECIPE_DETAILS}
AttributeDefinitions:
- AttributeName: recipeId
AttributeType: N
KeySchema:
- AttributeName: recipeId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment