S3 이미지 관련 제약 사항
파일 확장자
.jpg
.png
.jpeg
파일 크기
원본 이미지 → 압축
썸네일: 최대 25MB
S3 내 폴더 구조 (
참고자료
)
프로필
리사이징 : /
profile
/
<userId>
/
<image_size>
*/<uuid>_<timestamp>.{ext}*
원——본 : /
profile
/
<userId>
*/
origin
/<uuid>_<timestmap>.{ext}*
임——시 : /
delete
/
profile
/
<userId>
*/<uuid>_<timestamp>.{ext}*
피드
리사이징 : /
feed
/{feed_id}/
<image_size>
*/{uuid}_{timestamp}.{ext}*
원——본 : /
feed
/{feed_id}/
origin
/{uuid}_{timestamp}.{ext}
임——시 : /
delete
/
feed
/{feed_id}/{uuid}_{timestamp}.{ext}a
채팅방 대표 이미지
리사이징 : /
chatroom
/
<chatroom_id>
/
<image_size>/
*{uuid}_{timestamp}.{ext}*
원——본 : /
chatroom
/
<chatroom_id>
*/
origin/
{uuid}_{timestamp}.{ext}*
임——시 : /
delete
/
chatroom
/
<chatroom_id>
*/{uuid}_{timestamp}.{ext}*
채팅
리사이징 : /
chatroom
/
<chatroom_id>
/
chat
/
<chat_id>
/
<image_size>
*/{uuid}_{timestamp}.{ext}*
원——본 : /
chatroom
/
<chatroom_id>
/
chat
/
<chat_id>
*/
origin
/{uuid}_{timestamp}.{ext}*
임——시 : /
delete
/
chatroom
/
<chatroom_id>
/
chat
/
<chat_id>
*/{uuid}_{timestamp}.{ext}*
채팅방 사용자 프로필
리사이징 : /
chatroom
/
<chatroom_id>
/
chat_profile
/<user_id>/
<image_size>
*/{uuid}_{timestamp}.{ext}*
원——본 : /
chatroom
/
<chatroom_id>
*/
chat_profile
/<user_id>/
origin
/{uuid}_{timestamp}.{ext}*
임——시 : /
delete
/
chatroom
/
<chatroom_id>
*/
chat_profile
/<user_id>/{uuid}_{timestamp}.{ext}*
파일명
(key)
사용 가능 문자 (최대한 기호를 피할 것)
UTF-8 문자
0~9
A-Z
슬래시(
/
)
느낌표(
!
)
하이픈(
-
)
언더바(
_
)
마침표(
.
)
별표(
*
)
작은 따옴표(
’
)
여는 괄호 (
(
)
닫는 괄호 (
)
)
링크 만료 시간(expires) ⇾ 어떤 기준으로 적정 시간을 정해야 할 지 모르겠어서 일단 막 함
PUT 5분 (PUT 권한이 오래 걸려 있으면 위험하지 않을까 싶어서)
GET 12시간 (CDN 써도 S3 바로 접근이 안 되는 거지, 인스타도 주소만 알면 비공개 유저 사진도 접근 가능함. 굳이 짧게 가질 이유가 없다고 생각함)
요청 경로 처리
방법 1. FE가 규격에 맞게 주소 조회 (리사이징 중이면 원본 재요청)
방법 2. BE가 로드 밸런서로 기종에 맞게 조회 (리사이징 중이면 원본 반환)
유효하지 않은 S3 이미지 삭제
처음에는 delete 디렉토리에 저장 ⇾ 서버에 저장되면 이미지 복사 ⇾ 리사이징
주기적으로 delete 디렉토리의 이미지 제거
참고 자료
Presigned Url 종류
어떤 걸 정해드려야 하는 건지 이해 못 함..ㅎ