Я использую aws s3 SDK в своем коде. В своих тестах я пытаюсь создать / удалить сегменты для теста.
Моя версия sdk - 1.11.800:
<aws-s3-sdk.version>1.11.800</aws-s3-sdk.version>
<aws-java-sdk-core.version>1.11.800</aws-java-sdk-core.version>
Код создания точно такой же, как в aws примеры:
public void createBucket(String bucketName){
try {
if (!s3Client.doesBucketExistV2(bucketName)) {
// Because the CreateBucketRequest object doesn't specify a region, the
// bucket is created in the region specified in the client.
s3Client.createBucket(new CreateBucketRequest(bucketName));
// Verify that the bucket was created by retrieving it and checking its location.
String bucketLocation = s3Client.getBucketLocation(new GetBucketLocationRequest(bucketName));
System.out.println("Bucket location: " + bucketLocation);
}
} catch (AmazonServiceException e) {
// The call was transmitted successfully, but Amazon S3 couldn't process
// it and returned an error response.
e.printStackTrace();
} catch (SdkClientException e) {
// Amazon S3 couldn't be contacted for a response, or the client
// couldn't parse the response from Amazon S3.
e.printStackTrace();
}
}
Исключение:
22:32:33.949 [main] DEBUG com.amazonaws.request - Received error response: com.amazonaws.services.s3.model.AmazonS3Exception: You have attempted to create more buckets than allowed (Service: Amazon S3; Status Code: 400; Error Code: TooManyBuckets; Request ID: 4FE57EE4ACC6C7E4; S3 Extended Request ID: qIzyYNg6Il9J+ehR+JM3W5+RZWg43GJIU9v4EA5ajHG05bUydw8lN3qLZY5u/QjdXhV8tJlINMk=; Proxy: null), S3 Extended Request ID: qIzyYNg6Il9J+ehR+JM3W5+RZWg43GJIU9v4EA5ajHG05bUydw8lN3qLZY5u/QjdXhV8tJlINMk=
com.amazonaws.services.s3.model.AmazonS3Exception: You have attempted to create more buckets than allowed (Service: Amazon S3; Status Code: 400; Error Code: TooManyBuckets; Request ID: 4FE57EE4ACC6C7E4; S3 Extended Request ID: qIzyYNg6Il9J+ehR+JM3W5+RZWg43GJIU9v4EA5ajHG05bUydw8lN3qLZY5u/QjdXhV8tJlINMk=; Proxy: null), S3 Extended Request ID: qIzyYNg6Il9J+ehR+JM3W5+RZWg43GJIU9v4EA5ajHG05bUydw8lN3qLZY5u/QjdXhV8tJlINMk=
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1811)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1395)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1371)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5062)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5008)
at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:1097)
У меня более 100 сегментов в моем аккаунте, но когда я пытаюсь создать сегмент в консоль aws я успешно создаю ее без каких-либо проблем.
Когда я создаю ведро вручную и запускаю другие тесты (которые не создают это ведро), я могу успешно помещать и удалять контент из корзины, поэтому это не проблема с учетными данными ..