** 먼저 S3 버킷이 존재해야 한다. 버킷이 없다면 하나 만들자.

 

일단은 Lambda 메뉴에서 [Create a Lambda function]를 클릭한다.

  • Select blueprint 화면
  • Flter에서 s3 입력
  • s3-get-object 선택

그러면 triggers 설정으로 진입한다. 버켓명 입력하고 Event type 설정한다. 일단 테스트를 위해 Object Created (All)을 선택한다. 그리고 하단에 Enable trigger도 체크한다.

이것저것 리뷰한 후 [Create Function]해서 만든다.

Congratulations! Your Lambda function "[내가만든람다함수]" has been successfully created and configured with mysarctests3bucket as a trigger. You can now click on the "Test" button to input a test event and test your function.

 

[Test]를 눌러보자.

만약 에러가 발생한다면?

{
  "errorMessage": "Error getting object [파일명] from bucket [버킷명]. Make sure they exist and your bucket is in the same region as this function."
}

1. 테스트 이벤트를 수정한다. [Actions] 탭에서 [Configure test event]를 누르면 테스트 이벤트를 수정할 수 있다. 버킷 이름이나 파일 명이 맞지 않을 수 있다.

2.  이 Lambda의 Role에 S3를 억세스할 수 있는 적절한 권한이 들어있는지 확인한다. (AmazonS3FullAccess)