AWS S3 생성 오류 : "이벤트가 알림에 지원되지 않습니다 (서비스 : Amazon S3, 상태 코드 : 400, 오류 코드 : InvalidArgument").

Awenclaw

S3 이벤트에 의해 트리거되는 것으로 가정하는 Code9에서 첫 번째 람다를 개발 중입니다. 불행히도 배포하려고 할 때 CloudFormation 오류가 계속 발생합니다.

"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)"


AWS Mgm 콘솔의 아래 CloudFormation 이벤트를 참조하십시오.

여기에 이미지 설명 입력

다음은 내 AWS SAM template.yaml파일입니다.

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:*

Policies:오류가 권한 부족과 관련이 있다고 의심했기 때문에 IAM 정책을 확장하기 위해 추가 한 다음 줄 은 도움이되지 않습니다.
아래에서는 SAM에서 생성 된 CloudFormation 템플릿을 첨부합니다 template.yaml.

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "An AWS Serverless Specification template describing your function.",
  "Resources": {
    "olatexXlsxOrderLoader": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Code": {
          "S3Bucket": "cloud9-026528720964-sam-deployments-eu-central-1",
          "S3Key": "6aa2a5885a77ea790684cb345d822ed8"
        },
        "Description": "",
        "Tags": [
          {
            "Value": "SAM",
            "Key": "lambda:createdBy"
          }
        ],
        "MemorySize": 128,
        "Handler": "olatexXlsxOrderLoader/index.handler",
        "Role": {
          "Fn::GetAtt": [
            "olatexXlsxOrderLoaderRole",
            "Arn"
          ]
        },
        "Timeout": 15,
        "Runtime": "nodejs12.x"
      }
    },
    "olatexXlsxOrderLoaderRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": [
                "sts:AssumeRole"
              ],
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "lambda.amazonaws.com"
                ]
              }
            }
          ]
        },
        "ManagedPolicyArns": [
          "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
          "arn:aws:iam::aws:policy/AmazonS3FullAccess",
          "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"
        ],
        "Tags": [
          {
            "Value": "SAM",
            "Key": "lambda:createdBy"
          }
        ]
      }
    },
    "olatexOrdersInputDirectory": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "NotificationConfiguration": {
          "LambdaConfigurations": [
            {
              "Function": {
                "Fn::GetAtt": [
                  "olatexXlsxOrderLoader",
                  "Arn"
                ]
              },
              "Event": "S3:ObjectCreated:*"
            }
          ]
        }
      },
      "DependsOn": [
        "olatexXlsxOrderLoaderS3EventPermission"
      ]
    },
    "olatexXlsxOrderLoaderS3EventPermission": {
      "Type": "AWS::Lambda::Permission",
      "Properties": {
        "Action": "lambda:InvokeFunction",
        "SourceAccount": {
          "Ref": "AWS::AccountId"
        },
        "FunctionName": {
          "Ref": "olatexXlsxOrderLoader"
        },
        "Principal": "s3.amazonaws.com"
      }
    }
  }
}

모든 도움에 감사드립니다!
감사합니다
Andrzej

마르신

의견을 기반으로합니다.

이 문제는 S3:ObjectCreated:*대신을 사용하여 발생했습니다 s3:ObjectCreated:*.

S3 이벤트 이름은 대소 문자를 구분 합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관