list-objects

Prev Next

Classic/VPC 환경에서 이용 가능합니다.

버킷에 저장된 객체의 목록을 조회합니다.

구문

list-objects 구문은 다음과 같습니다.

aws s3api list-objects \
    --bucket <bucket> \
    [--delimiter <delimiter>] \
    [--prefix <prefix>] \
    [--starting-token <starting-token>] \
    [--page-size <page-size>] \
    [--max-items <max-items>] \
    --endpoint-url <endpoint-url>

옵션

list-objects 실행 시 지정할 수 있는 옵션을 설명합니다.

필수 옵션

list-objects의 필수 옵션입니다.

옵션 타입 필수 여부 설명
--bucket String Required 버킷 이름

선택 옵션

list-objects의 선택 옵션입니다. 지정하지 않은 옵션에는 기본값이 적용됩니다.

옵션 타입 필수 여부 설명
--delimiter String Optional 객체를 묶기 위한 구분자
  • Prefix와 Delimiter 사이에 있는 객체를 하나로 묶음
--prefix String Optional 조회할 Prefix
--starting-token String Optional 조회를 시작할 위치
--page-size Integer Optional 페이지당 항목 수
  • 1~1000
--max-items Integer Optional 출력에 포함할 총 항목 수

공통 옵션

aws 명령에서 공통으로 사용하는 옵션에 대한 정보는 Object Storage 옵션을 참조해 주십시오.

예시

객체 목록 조회 요청이 성공하면 각 객체의 식별 정보와 크기가 반환됩니다.

명령

명령 예시는 다음과 같습니다.

aws s3api list-objects --bucket my-test-bucket \
    --endpoint-url=https://kr.object.ncloudstorage.com

접두사로 객체를 필터링하는 명령 예시는 다음과 같습니다.

aws s3api list-objects --bucket my-test-bucket \
    --prefix docs/ \
    --endpoint-url=https://kr.object.ncloudstorage.com

한 번에 조회할 개수를 제한하는 명령 예시는 다음과 같습니다.

aws s3api list-objects --bucket my-test-bucket \
    --max-items 2 \
    --page-size 2 \
    --endpoint-url=https://kr.object.ncloudstorage.com

이전 응답의 NextToken으로 다음 페이지를 조회하는 명령 예시는 다음과 같습니다.

aws s3api list-objects --bucket my-test-bucket \
    --max-items 2 \
    --page-size 2 \
    --starting-token eyJNYXJrZXIiOiAiaW1nL2ltYWdlLnBuZyJ9 \
    --endpoint-url=https://kr.object.ncloudstorage.com

출력

출력 예시는 다음과 같습니다.

{
    "Contents": [
        {
            "Key": "docs/report.txt",
            "LastModified": "2026-09-02T05:33:23.884Z",
            "ETag": "\"2732fae1c46437ca8a558987ed1c1229\"",
            "Size": 41,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "img/image.png",
            "LastModified": "2026-09-02T06:39:50.488Z",
            "ETag": "\"2cd8bde463f5d82aae0f0cec061d6b8f\"",
            "Size": 70,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "large.bin",
            "LastModified": "2026-09-02T06:41:01.883Z",
            "ETag": "\"57325bca2c5c2cb6adf5aa9a66fb4e2d\"",
            "Size": 5242880,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "notes.txt",
            "LastModified": "2026-09-02T05:33:24.692Z",
            "ETag": "\"cc87f4af4dc404e7dd08a9309df6a374\"",
            "Size": 24,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "sample.txt",
            "LastModified": "2026-09-02T05:33:23.549Z",
            "ETag": "\"d48c6f4176cc2713372e2a605811ec19\"",
            "Size": 46,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        }
    ],
    "RequestCharged": null
}

접두사로 필터링한 출력 예시는 다음과 같습니다.

{
    "Contents": [
        {
            "Key": "docs/report.txt",
            "LastModified": "2026-09-02T05:33:23.884Z",
            "ETag": "\"2732fae1c46437ca8a558987ed1c1229\"",
            "Size": 41,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        }
    ],
    "RequestCharged": null
}

한 번에 조회할 개수를 제한한 출력 예시는 다음과 같습니다. 다음 페이지가 있으면 NextToken이 함께 반환됩니다.

{
    "Contents": [
        {
            "Key": "docs/report.txt",
            "LastModified": "2026-09-02T05:33:23.884Z",
            "ETag": "\"2732fae1c46437ca8a558987ed1c1229\"",
            "Size": 41,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "img/image.png",
            "LastModified": "2026-09-02T06:39:50.488Z",
            "ETag": "\"2cd8bde463f5d82aae0f0cec061d6b8f\"",
            "Size": 70,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        }
    ],
    "RequestCharged": null,
    "NextToken": "eyJNYXJrZXIiOiAiaW1nL2ltYWdlLnBuZyJ9"
}

다음 페이지를 조회한 출력 예시는 다음과 같습니다.

{
    "Contents": [
        {
            "Key": "large.bin",
            "LastModified": "2026-09-02T06:41:01.883Z",
            "ETag": "\"57325bca2c5c2cb6adf5aa9a66fb4e2d\"",
            "Size": 5242880,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        },
        {
            "Key": "notes.txt",
            "LastModified": "2026-09-02T05:33:24.692Z",
            "ETag": "\"cc87f4af4dc404e7dd08a9309df6a374\"",
            "Size": 24,
            "StorageClass": "Standard",
            "Owner": {
                "DisplayName": "ncp-123456-0",
                "ID": "ncp-123456-0"
            }
        }
    ],
    "RequestCharged": null,
    "NextToken": "eyJNYXJrZXIiOiAibm90ZXMudHh0In0="
}