- 1) 기본 권한 설정
- 1-1) Public 접근
- 서비스를 할 수 있도록, 적절히 지정.
- 1-2) CORS
- 필요하다면, 작성.
- 1-1) Public 접근
- 2) 이벤트 속성 설정
- 2-1) Lambda Event Trigger 셋팅
- 특정 object의 특정 이벤트에 관해서, 특정 람다함수와 잘 연동을 하면 된다.
- (*주의*)
- (한번은, image가 업로드 되면 -> resize하여 재저장 하였는데)
- (업로드 폴더와 재저장 폴터를 동일하게 하여...)
- (image업로드 -> (람다이벤트) -> resize재저장 -> (람다이벤트) -> resize재저장 -> ... 무한반복)
- (순식간에 S3 요금폭탄 맞음!!! 진짜 ㅈ 될뻔함;;;)
- 2-1) Lambda Event Trigger 셋팅
- 3) Object 작업
- 3-1) Pre-Signed URL
- https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html
- https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-presigned-urls.html
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html
- 업로드 예)
- url = s3_client.generate_presigned_url(
- 'put_object',
- Params={'Bucket': 버킷, 'Key':키}
- ) // 해당 url 으로 http PUT 으로 Body를 binary로 파일 넣으니 됨.
- url = s3_client.generate_presigned_post('버킷', '키') // 이상하게 시그니쳐 안맞다고 잘 안됨...
- url = s3_client.generate_presigned_url(
- ...
- 3-1) Pre-Signed URL
;
- % AWS CLI 동기화 명령어
- aws s3 ls --profile neo --region ap-northeast-2
- aws s3 sync . s3://neo/nas --profile neo --region ap-northeast-2
- ...
- aws s3 ls --profile neo2 --region us-east-2
- aws s3 sync s3://neo2/nas ./test --profile neo2 --region us-east-2
-끝-
'AWS' 카테고리의 다른 글
AWS CodePipeline (0) | 2020.03.11 |
---|---|
AWS CodeCommit (0) | 2020.03.10 |
AWS Lambda (0) | 2020.03.08 |
Amazon API Gateway (0) | 2020.02.27 |
Amazon Managed Blockchain (0) | 2019.04.27 |