教程:将AWS Lambda与Amazon S3错误一起使用

时间:2016-04-16 16:58:39

标签: amazon-web-services amazon-s3 aws-lambda

我正试图通过the tutorial。 为什么我会得到以下错误:

2016-04-16T16:49:28.286Z   2f034bdd-03f3-11e6-8855-c9c0e483eadd    Reading options from event:
 { Records: 
   [ { eventVersion: '2.0',
       eventTime: '1970-01-01T00:00:00.000Z',
       requestParameters: { sourceIPAddress: '127.0.0.1' },
       s3: 
        { configurationId: 'testConfigRule',
          object: 
           { eTag: '0123456789abcdef0123456789abcdef',
             sequencer: '0A1B2C3D4E5F678901',
             key: 'HappyFace.jpg',
             size: 1024 },
          bucket: 
           { arn: 'arn:aws:s3:::mybucket',
             name: 'sourcebucket',
             ownerIdentity: { principalId: 'EXAMPLE' } },
          s3SchemaVersion: '1.0' },
       responseElements: 
        { 'x-amz-id-2': 'EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH',
          'x-amz-request-id': 'EXAMPLE123456789' },
       awsRegion: 'us-east-1',
       eventName: 'ObjectCreated:Put',
       userIdentity: { principalId: 'EXAMPLE' },
       eventSource: 'aws:s3' } ] }
2016-04-16T16:49:28.327Z    2f034bdd-03f3-11e6-8855-c9c0e483eadd    Unable to resize sourcebucket/HappyFace.jpg and upload to sourcebucketresized/resized-HappyFace.jpg due to an error: AccessDenied: Access Denied
END RequestId: 2f034bdd-03f3-11e6-8855-c9c0e483eadd
REPORT RequestId: 2f034bdd-03f3-11e6-8855-c9c0e483eadd  Duration: 42.44 ms  Billed Duration: 100 ms     Memory Size: 1024 MB    Max Memory Used: 54 MB`

1 个答案:

答案 0 :(得分:0)

我认为您对lambda的执行角色没有对您正在使用的存储区的权限。 您可以尝试这样做,例如转到您正在使用的s3存储桶,然后单击右侧的属性选项卡,然后单击权限部分。您可以在此处提供适当的访问权限,或者出于测试目的,您可以访问所有人。 http://docs.aws.amazon.com/AmazonS3/latest/dev/intro-managing-access-s3-resources.html