반응형
Error
SpringBoot에서 DynamoDB Local 사용하여 실행 시 아래와 같은 에러 발생
Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to load region from any of the providers in the chain software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain@68a97fc1: [software.amazon.awssdk.regions.providers.SystemSettingsRegionProvider@36f80ceb: Unable to load region from system settings. Region must be specified either via environment variable (AWS_REGION) or system property (aws.region)., software.amazon.awssdk.regions.providers.AwsProfileRegionProvider@5b8599c7: No region provided in profile: default, software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider@4aadf144: Unable to contact EC2 metadata service.]
반응형
Solution
DynamoDB Local을 특정 region이 없으나 아래와 같이 DynamoDBClient생성시 region값을 설정해야함.
어떤값을 넣어도 상관없음
@Bean
public DynamoDbAsyncClient dynamoDbAsyncClient() {
return DynamoDbAsyncClient.builder()
.region(Region.of(region))
.endpointOverride(URI.create(dynamoDBEndpoint))
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(accessKey, secretKey)))
.build();
}
Thank you!
반응형