Skip to content

Restore default AWS credential chain support for S3 adapter #128

Description

@Hyunstone

Summary

현재 feature.storage.enabled=false로 기본 비활성화되어 있어 당장 서비스에는 영향이 없지만, S3 storage를 다시 활성화할 때 AwsS3Config가 static access key/secret key만 지원하도록 고정되어 있습니다.

이 상태에서는 이전에 허용되던 AWS 기본 credential chain 사용 시나리오를 다시 붙일 수 없습니다.

Current Behavior

  • 현재 구현: /src/main/java/com/mogak/spring/config/AwsS3Config.java
  • S3Client 생성 시 아래 3개 값을 필수로 받음
    • spring.cloud.aws.region.static
    • spring.cloud.aws.credentials.access-key
    • spring.cloud.aws.credentials.secret-key
  • 내부적으로 StaticCredentialsProvider + AwsBasicCredentials만 사용함

Why This Is A Problem

이전 dev 설정은 instance profile 기반 인증을 허용하고 있었습니다.

기준 커밋 이전 application-dev.yml:

  • spring.cloud.aws.credentials.instance-profile: true

즉, 현재 구현은 storage 재활성화 시 아래 시나리오를 막습니다.

  • EC2 instance profile
  • IRSA
  • 로컬 AWS profile/default credential chain
  • 기타 AWS SDK 기본 credential provider chain 기반 실행

지금은 storage가 기본 비활성이라 blocker는 아니지만, 나중에 feature.storage.enabled=true로 다시 켤 때 기능 회귀가 됩니다.

Expected Behavior

AwsS3Config는 static key 강제 방식이 아니라 AWS SDK v2의 기본 credential chain을 우선 지원해야 합니다.

최소 요구사항:

  • static key 없이도 기본 credential chain으로 동작 가능해야 함
  • instance profile / IRSA / local profile 사용 가능해야 함
  • 필요 시 명시적 access key/secret key도 선택적으로 지원 가능해야 함

Suggested Direction

  • S3Client.builder()에서 credential provider를 하드코딩하지 않거나
  • static key가 주어진 경우에만 StaticCredentialsProvider를 쓰고
  • 그렇지 않으면 DefaultCredentialsProvider를 사용하도록 분기

Scope

  • 지금 당장 storage를 활성화하는 작업은 아님
  • feature.storage.enabled=true를 다시 지원하기 위한 후속 정리 이슈

Metadata

Metadata

Assignees

Labels

bug기능이 정상적으로 작동하지 않을 때 이슈

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions