Skip to content

Instantly share code, notes, and snippets.

@harrietty
Created July 21, 2017 11:28
Show Gist options
  • Save harrietty/f0e5c83abc7c145f6ceaa3a5eb3707e9 to your computer and use it in GitHub Desktop.
Save harrietty/f0e5c83abc7c145f6ceaa3a5eb3707e9 to your computer and use it in GitHub Desktop.
service: donkeyjob
provider:
name: aws
runtime: nodejs6.10
functions:
getdonkeyjobs:
handler: handler.getdonkeyjobs
resources:
Resources:
donkeyjobs:
Type: AWS::DynamoDB::Table
Properties:
TableName: donkeyjobs
AttributeDefinitions:
- AttributeName: listingId
AttributeType: S
KeySchema:
- AttributeName: listingId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
# A policy is a resource that states one or more permssions. It lists actions, resources and effects.
DynamoDBIamPolicy:
Type: AWS::IAM::Policy
DependsOn: donkeyjobs
Properties:
PolicyName: lambda-dynamodb
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: arn:aws:dynamodb:*:*:table/donkeyjobs
Roles:
- Ref: IamRoleLambdaExecution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment