Computer Science/에러 기록 정리

[boto3]An error occurred (404) when calling the HeadObject operation

JG Ahn 2019. 11. 13. 17:29

Environment

- python 3.7

 

Error

- An error occurred (404) when calling the HeadObject operation

 

Situation

- boto3을 사용해 s3에서 파일을 다운로드할 때 해당 에러가 발생한다

import boto3

FILE_PATH = 'image/atv_rider0001.jpg'
BUCKET_NAME = 'flxr_yolo'
KEY = 'image/atv_rider0001.jpg'

client = boto3.client('s3')
client.download_file(BUCKET_NAME, KEY, FILE_PATH)

 

Solution

- Bucket의 이름이 잘못 표기되어 있었다..

- 정확한 이름 : flxr-yolo로 변경하니 제대로 작동한다.

- 다른 자료들을 찾아보니 대부분 경로 설정이나 오타와 같은 단순한 문제였다

 

Ref

1. https://stackoverflow.com/questions/45109533/aws-cli-s3-copying-file-locally-using-the-terminal-fatal-error-an-error-occu

2. https://stackoverflow.com/questions/46635895/aws-boto3-s3-python-an-error-occurred-404-when-calling-the-head object-operat?rq=1