작성자 : 김다희

S3 Upload 기능 구현을 위해 아래 블로그를 참고함.

https://bamdule.tistory.com/177?category=439472

오류 1.

  1. S3 생성

  2. 의존성 추가

    implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.2.1.RELEASE'
    
  3. application run

    1. 오류남
    because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
    

해결

  1. 애플리케이션이 EC2 인스턴스에서 실행 중인 경우에만 리전 감지가 가능하다고 한다.

    버킷 정보를 yaml 파일에 등록해주자.

    cloud:
      aws:
        credentials:
          accessKey: ${IAM_ACCESS_KEY}
          secretKey: ${IAM_SECRET_KEY}
        s3:
          bucket: ${BUCKET_NAME}
        region:
          static: ap-northeast-2
        stack:
          auto: false
    

오류 2.

  1. acl 관련 오류가 남.

해결

  1. aws s3 객체 소유권 acl 활성화로 변경.

Untitled