

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Snowball Edge의 Snowball Edge에서 Amazon S3 호환 스토리지의 버킷에 객체 나열
<a name="objects-list-s3-snow"></a>

다음 예제에서는를 사용하여 Amazon S3 compatible storage on Snowball Edge 버킷의 객체를 나열합니다 AWS CLI. SDK 명령은 `s3-snow:ListObjectsV2`입니다. 이 명령을 사용하려면 각각의 사용자 입력 자리 표시자를 사용자의 정보로 바꿉니다.

```
aws s3api list-objects-v2 --bucket {{sample-bucket}} --endpoint-url {{s3api-endpoint-ip}} --profile {{your-profile}}
```

이 명령에 대한 자세한 내용은 [AWS CLI Command Reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/list-objects-v2.html)의 *list-objects-v2* 섹션을 참조하세요.

다음 Amazon S3 compatible storage on Snowball Edge 예제에서는 Java용 SDK를 사용하여 버킷의 객체를 나열합니다. 이 명령을 사용하려면 각 사용자 입력 자리 표시자를 사용자의 정보로 대체합니다.

이 예시에서는 ListObjects API 작업의 최신 버전인 [ListObjectsV2](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html)를 사용합니다. 애플리케이션 개발 시 이 개정된 API 작업을 사용하는 것이 좋습니다. 이전 버전과의 호환성을 위해 Amazon S3는 이 API 작업의 이전 버전을 계속 지원합니다.

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.ListObjectsV2Request;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.S3ObjectSummary;

public class ListObjectsV2 {

    public static void main(String[] args) {
        String bucketName = "*** Bucket name ***";

        try {
            // This code expects that you have AWS credentials set up per:
            // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .enableUseArnRegion()
                    .build();

            System.out.println("Listing objects");

            // maxKeys is set to 2 to demonstrate the use of
            // ListObjectsV2Result.getNextContinuationToken()
            ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucketName).withMaxKeys(2);
            ListObjectsV2Result result;

            do {
                result = s3Client.listObjectsV2(req);

                for (S3ObjectSummary objectSummary : result.getObjectSummaries()) {
                    System.out.printf(" - %s (size: %d)\n", objectSummary.getKey(), objectSummary.getSize());
                }
                // If there are more than maxKeys keys in the bucket, get a continuation token
                // and list the next objects.
                String token = result.getNextContinuationToken();
                System.out.println("Next Continuation Token: " + token);
                req.setContinuationToken(token);
            } while (result.isTruncated());
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it 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();
        }
    }
}
```