title: AWS S3 creation error: "The event is not supported for notifications (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument"
body: <br>
  I'm developing my first lambda in Code9 that suppose to be triggered by S3 event. Unfortunetly, when I'm trying to deploy, I'm constantly getting CloudFormation Error: <br><br>
  <pre><code>&quot;The event is not supported for notifications (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: CF3108325F3C9B60; S3 Extended Request ID: wcWzRXUu7YJn/BVnPDtOx7yBHllhIPELEwsTweqVcfwLw1hkR2iDiSmQbxeL3Hrtp7Kv58ujS2s=; Proxy: null)&quot;
  </code></pre>
  <p><br> See below CloudFormation events from AWS Mgm Console:</p>
  <p><a href="https://i.stack.imgur.com/YR3My.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YR3My.png" alt="enter image description here" /></a></p>
  <p>Below is my AWS SAM <code>template.yaml</code> file:</p>
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  Transform: 'AWS::Serverless-2016-10-31'
  Description: An AWS Serverless Specification template describing your function.
  Resources:
    olatexOrdersInputDirectory:
      Type: 'AWS::S3::Bucket'
    olatexXlsxOrderLoader:
      Type: 'AWS::Serverless::Function'
      Properties:
        Handler: olatexXlsxOrderLoader/index.handler
        Runtime: nodejs12.x
        Description: ''
        MemorySize: 128
        Timeout: 15
        Policies:
        - AWSLambdaBasicExecutionRole
        - AmazonS3FullAccess
        - AmazonDynamoDBFullAccess
        Events:
          S3Event:
            Type: S3
            Properties:
              Bucket: !Ref olatexOrdersInputDirectory
              Events: S3:ObjectCreated:*
  </code></pre>
  <p>Lines after <code>Policies:</code> I've added to extend IAM policies because I was suspecting error is related to insufficient privilages but it doesn't helped. <br>
  Below I'm attaching CloudFormation templte that is generated from SAM's <code>template.yaml</code>:</p>
  <pre><code>{
    &quot;AWSTemplateFormatVersion&quot;: &quot;2010-09-09&quot;,
    &quot;Description&quot;: &quot;An AWS Serverless Specification template describing your function.&quot;,
    &quot;Resources&quot;: {
      &quot;olatexXlsxOrderLoader&quot;: {
        &quot;Type&quot;: &quot;AWS::Lambda::Function&quot;,
        &quot;Properties&quot;: {
          &quot;Code&quot;: {
            &quot;S3Bucket&quot;: &quot;cloud9-026528720964-sam-deployments-eu-central-1&quot;,
            &quot;S3Key&quot;: &quot;6aa2a5885a77ea790684cb345d822ed8&quot;
          },
          &quot;Description&quot;: &quot;&quot;,
          &quot;Tags&quot;: [
            {
              &quot;Value&quot;: &quot;SAM&quot;,
              &quot;Key&quot;: &quot;lambda:createdBy&quot;
            }
          ],
          &quot;MemorySize&quot;: 128,
          &quot;Handler&quot;: &quot;olatexXlsxOrderLoader/index.handler&quot;,
          &quot;Role&quot;: {
            &quot;Fn::GetAtt&quot;: [
              &quot;olatexXlsxOrderLoaderRole&quot;,
              &quot;Arn&quot;
            ]
          },
          &quot;Timeout&quot;: 15,
          &quot;Runtime&quot;: &quot;nodejs12.x&quot;
        }
      },
      &quot;olatexXlsxOrderLoaderRole&quot;: {
        &quot;Type&quot;: &quot;AWS::IAM::Role&quot;,
        &quot;Properties&quot;: {
          &quot;AssumeRolePolicyDocument&quot;: {
            &quot;Version&quot;: &quot;2012-10-17&quot;,
            &quot;Statement&quot;: [
              {
                &quot;Action&quot;: [
                  &quot;sts:AssumeRole&quot;
                ],
                &quot;Effect&quot;: &quot;Allow&quot;,
                &quot;Principal&quot;: {
                  &quot;Service&quot;: [
                    &quot;lambda.amazonaws.com&quot;
                  ]
                }
              }
            ]
          },
          &quot;ManagedPolicyArns&quot;: [
            &quot;arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole&quot;,
            &quot;arn:aws:iam::aws:policy/AmazonS3FullAccess&quot;,
            &quot;arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess&quot;
          ],
          &quot;Tags&quot;: [
            {
              &quot;Value&quot;: &quot;SAM&quot;,
              &quot;Key&quot;: &quot;lambda:createdBy&quot;
            }
          ]
        }
      },
      &quot;olatexOrdersInputDirectory&quot;: {
        &quot;Type&quot;: &quot;AWS::S3::Bucket&quot;,
        &quot;Properties&quot;: {
          &quot;NotificationConfiguration&quot;: {
            &quot;LambdaConfigurations&quot;: [
              {
                &quot;Function&quot;: {
                  &quot;Fn::GetAtt&quot;: [
                    &quot;olatexXlsxOrderLoader&quot;,
                    &quot;Arn&quot;
                  ]
                },
                &quot;Event&quot;: &quot;S3:ObjectCreated:*&quot;
              }
            ]
          }
        },
        &quot;DependsOn&quot;: [
          &quot;olatexXlsxOrderLoaderS3EventPermission&quot;
        ]
      },
      &quot;olatexXlsxOrderLoaderS3EventPermission&quot;: {
        &quot;Type&quot;: &quot;AWS::Lambda::Permission&quot;,
        &quot;Properties&quot;: {
          &quot;Action&quot;: &quot;lambda:InvokeFunction&quot;,
          &quot;SourceAccount&quot;: {
            &quot;Ref&quot;: &quot;AWS::AccountId&quot;
          },
          &quot;FunctionName&quot;: {
            &quot;Ref&quot;: &quot;olatexXlsxOrderLoader&quot;
          },
          &quot;Principal&quot;: &quot;s3.amazonaws.com&quot;
        }
      }
    }
  }
  </code></pre>
  <p>Thanks a lot for all your help!<br>
  Regards<br>
  Andrzej</p>