title: How to create an EventSourceMapping with serverless 1.0?
body: <p>I am trying to set up an event source map so the Lambda Function gets call every time a record gets committed into my dynamodb table. I am trying to follow up the instructions from</p>
  
  <p><a href="https://github.com/serverless/serverless/blob/master/docs/guide/overview-of-event-sources.md" rel="nofollow">https://github.com/serverless/serverless/blob/master/docs/guide/overview-of-event-sources.md</a></p>
  
  <p>My current <code>serverless.yml</code> is using:</p>
  
  <pre><code>service: sl-pipeline
  
  provider:
    name: aws
    runtime: python2.7
    memorySize: ${memoryVar}
    iamRoleStatements:
      - Effect: "Allow"
        Action:
          - "dynamodb:*"
        Resource: "arn:aws:dynamodb:*:*:table/MyTable*"
      - Effect: "Allow"
        Action:
          - "dynamodb:GetRecords"
          - "dynamodb:GetShardIterator"
          - "dynamodb:DescribeStream"
          - "dynamodb:ListStreams"
        Resource: "arn:aws:dynamodb:*:*:table/MyTable*/stream/*"
  
  # you can overwrite defaults here
  defaults:
    stage: dev
    region: us-east-1
  
  functions:
    main:
      handler: handler.main
  
  # Add event trigger from dynamodb Stream Table
  resources:
    Resources:
      mapping:
        Type: AWS::Lambda::EventSourceMapping
        Properties:
          BatchSize: 10
          EventSourceArn: "arn:aws:dynamodb:us-east-1:XXXXXXXXX:table/MyTable/stream"
          FunctionName: "sl-pipeline-dev-main"
          StartingPosition: LATEST
  </code></pre>
  
  <p>And every time I call <code>serverless deploy</code>, I get:</p>
  
  <pre><code> Serverless Error ---------------------------------------
  
   An error occurred while provisioning your cloudformation:
   The following resource(s) failed to create: [IamRoleLambda,
   mapping]. 
  </code></pre>
  
  <p>I am guessing this has to do with IAM role permissions, but cannot figure out how to fix it. For the role I use for serverless itself, I have tried to just use:</p>
  
  <pre><code>Action: "*"
  Resource: "*"
  </code></pre>
  
  <p>so it should be able to do anything.</p>
  
  <p>Note that if I remove the <code>resources</code> section from the <code>serverless.yml</code>, I can deploy correctly. I can even go to the dynamodb table, and manually add the trigger to the lambda function and it all works.</p>
  
  <p>Thanks in advance</p>