

# 자습서: Amazon Kinesis 프록시로 REST API 생성
<a name="integrating-api-with-aws-services-s3"></a>

API Gateway에서 REST API를 사용하여 Amazon S3를 프록시하는 과정을 보여주는 이 예제 단원에서는 REST API를 생성하여 다음 Amazon S3 작업을 노출하도록 구성하는 방법을 설명합니다.
+ API의 루트 리소스에서 GET을 노출하여 [호출자의 모든 Amazon S3 버킷을 나열합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html).
+ 폴더 리소스에서 GET을 노출하여 [Amazon S3 버킷의 모든 객체 목록을 봅니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html).
+ 폴더/항목 리소스에서 GET을 노출하여 [Amazon S3 버킷에서 객체를 보거나 다운로드합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html).

 [Amazon S3 프록시로 샘플 API의 OpenAPI 정의](api-as-s3-proxy-export-swagger-with-extensions.md)에 표시된 대로 샘플 API를 Amazon S3 프록시로 가져올 수 있습니다. 이 샘플에는 노출된 메서드가 더 많이 포함되어 있습니다. OpenAPI 정의를 사용하여 API를 가져오는 방법에 대한 지침은 [API Gateway에서 OpenAPI를 사용하여 REST API 개발](api-gateway-import-api.md) 단원을 참조하십시오.

**참고**  
 API Gateway API를 Amazon S3와 통합하려면 API Gateway와 Amazon S3 서비스를 모두 사용할 수 있는 리전을 선택해야 합니다. 리전 사용 가능성은 [Amazon API Gateway 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/apigateway.html) 단원을 참조하십시오.

**Topics**
+ [API에서 Amazon S3 작업을 호출하도록 허용하는 IAM 권한 설정](#api-as-s3-proxy-iam-permissions)
+ [API 리소스를 생성하여 Amazon S3 리소스 표시](#api-as-s3-proxy-create-resources)
+ [API 메서드를 노출하여 호출자의 Amazon S3 버킷 나열](#api-root-get-as-s3-get-service)
+ [API 메서드를 노출하여 Amazon S3 버킷 액세스](#api-folder-operations-as-s3-bucket-actions)
+ [API 메서드를 노출하여 버킷에서 Amazon S3 객체 액세스](#api-items-in-folder-as-s3-objects-in-bucket)
+ [Amazon S3 프록시로 샘플 API의 OpenAPI 정의](api-as-s3-proxy-export-swagger-with-extensions.md)
+ [REST API 클라이언트를 사용하여 API 호출](api-as-s3-proxy-test-using-postman.md)

## API에서 Amazon S3 작업을 호출하도록 허용하는 IAM 권한 설정
<a name="api-as-s3-proxy-iam-permissions"></a>

 API에서 Amazon S3 작업을 간접적으로 호출하도록 허용하려면 적절한 IAM 정책을 IAM 역할에 연결해야 합니다. 이 단계에서는 새 IAM 역할을 생성합니다.

**AWS 서비스 프록시 실행 역할을 생성하려면**

1. AWS Management Console에 로그인하여 [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/)에서 IAM 콘솔을 엽니다.

1. **Roles**를 선택합니다.

1. **역할 생성**을 선택합니다.

1.  **신뢰할 수 있는 유형의 엔터티 선택**에서 **AWS 서비스**를 선택한 다음 **API Gateway**를 선택하고 **API Gateway가 로그를 CloudWatch Logs로 푸시하도록 허용**을 선택합니다.

1.  **다음**을 선택한 후 다시 **다음**을 선택합니다.

1. **역할 이름**에 **APIGatewayS3ProxyPolicy**를 입력한 다음 **역할 생성**을 선택합니다.

1. **역할** 목록에서 방금 생성한 역할을 선택합니다. 스크롤하거나 검색 창을 사용하여 역할을 찾을 수 있습니다.

1. 선택한 역할에 대해 **권한 추가** 탭을 선택합니다.

1. 드롭다운 목록에서 **정책 연결**을 선택합니다.

1. 검색 창에 **AmazonS3FullAccess**를 입력하고 **권한 추가**를 선택합니다.
**참고**  
이 자습서에서는 단순화를 위해 관리형 정책을 사용합니다. 가장 좋은 방법은 필요한 최소 권한을 부여하는 자체 IAM 정책을 생성하는 것입니다.

1. 새로 생성된 **역할 ARN**은 나중에 사용할 수 있도록 기록해 둡니다.

## API 리소스를 생성하여 Amazon S3 리소스 표시
<a name="api-as-s3-proxy-create-resources"></a>

API의 루트(`/`) 리소스를 인증된 호출자의 Amazon S3 버킷 컨테이너로 사용합니다. 또한 `Folder` 및 `Item` 리소스를 생성하여 각각 특정 Amazon S3 버킷과 특정 Amazon S3 객체를 표시합니다. 호출자는 요청 URL의 일부로 폴더 이름과 객체 키를 경로 파라미터 형식으로 지정합니다.

**참고**  
객체 키가 `/`나 다른 특수 문자를 포함하는 객체나에 액세스할 때 문자는 URL로 인코딩되어야 합니다. 예를 들어 `test/test.txt`는 `test%2Ftest.txt`으로 인코딩되어야 합니다.

**Amazon S3 서비스 기능을 표시하는 API 리소스를 생성하려면**

1.  Amazon S3 버킷을 생성한 AWS 리전에서 **MyS3**라는 API를 생성합니다. 이 API의 루트 리소스 **/**는 Amazon S3 서비스를 가리킵니다. 이 단계에서는**/\$1folder\$1**와 **/\$1item\$1**이라는 두 개의 추가 리소스를 생성합니다.

1. **리소스 생성**을 선택합니다.

1. **프록시 리소스**는 꺼진 상태로 둡니다.

1. **리소스 경로**에서 `/`를 선택합니다.

1. **리소스 이름**에 **\$1folder\$1**을 입력합니다.

1. **오리진 간 리소스 공유(CORS)**를 선택 취소된 상태로 둡니다.

1. **리소스 생성**을 선택합니다.

1. **/\$1folder\$1** 리소스를 선택한 다음 **리소스 생성**을 선택합니다.

1. 이전 단계를 사용하여 이름이 **\$1item\$1**인 하위 리소스 **/\$1folder\$1**를 생성합니다.

   최종 API는 다음과 같아야 합니다.

      
![\[API Gateway에서 Amazon S3 프록시로 API 생성\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_create_api-resources_new_console.png)

## API 메서드를 노출하여 호출자의 Amazon S3 버킷 나열
<a name="api-root-get-as-s3-get-service"></a>

호출자의 Amazon S3 버킷 목록을 가져오는 중에 Amazon S3에서 [GET Service](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html) 작업을 호출합니다. API의 루트 리소스(**/**)에서 GET 메서드를 생성합니다. 다음과 같이 Amazon S3와 통합하도록 GET 메서드를 구성합니다.

**API의 `GET /` 메서드를 생성하고 초기화하는 방법**

1. **/** 리소스를 선택한 다음 **메서드 생성**을 선택합니다.

1. 메서드 유형에서 **GET**을 선택합니다.

1. **통합 유형**에서 **AWS 서비스**를 선택합니다.

1. **AWS 리전**에서 Amazon S3 버킷을 생성한 AWS 리전을 선택합니다.

1. **AWS 서비스**에서 **Amazon Simple Storage Service**를 선택합니다.

1. **AWS 하위 도메인**은 비워 둡니다.

1. **HTTP 메서드**에서 **GET**을 선택합니다.

1. **작업 유형**에서 **경로 재정의 사용**을 선택합니다.

   경로 재정의를 사용하면 API Gateway가 클라이언트 요청을 해당하는 [Amazon S3 REST API path-style request](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAPI.html)로 Amazon S3로 전달합니다. 여기에서 Amazon S3 리소스가 `s3-host-name/bucket/key` 패턴의 리소스 경로에 의해 표현됩니다. API Gateway는 `s3-host-name`을 설정하고 클라이언트가 지정한 `bucket` 및 `key`를 클라이언트에서 Amazon S3로 전달합니다.

1. **경로 재정의**에서 **/**를 입력합니다.

1. **실행 역할**에 **APIGatewayS3ProxyPolicy**의 ARN을 입력합니다.

1. **메서드 요청 설정**을 선택합니다.

   메서드 요청 설정을 사용하여 API의 이 메서드를 직접 호출할 수 있는 사용자를 제어할 수 있습니다.

1. **권한 부여**의 드롭다운 메뉴에서 `AWS_IAM`을 선택합니다.

      
![\[메서드 응답 유형 선언\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_setup_method_request_authorization_new_console.png)

1. **메서드 생성**을 선택합니다.

이 설정은 프런트 엔드 `GET https://your-api-host/stage/` 요청을 백엔드 `GET https://your-s3-host/`와 통합합니다.

 API에서 성공적인 응답과 예외를 호출자에게 적절히 반환하도록 **메서드 응답**에서 200, 400 및 500 응답을 선언합니다. 여기에 선언되지 않은 상태 코드의 백엔드 응답은 호출자에게 200 응답으로 반환되도록 200 응답에 대한 기본 매핑을 사용합니다.

**`GET /` 메서드에 대한 응답 유형을 선언하려면**

1.  **메서드 응답** 탭의 **응답 200**에서 **편집**을 선택합니다.

1. **헤더 추가**를 선택하고 다음을 수행합니다.

   1. **헤더 이름**에 **Content-Type**을 입력합니다.

   1. **헤더 추가(Add header)**를 선택합니다.

   이 단계를 반복하여 **Timestamp** 헤더와 **Content-Length** 헤더를 생성합니다.

1. **저장**을 선택합니다.

1. **메서드 응답** 탭의 **메서드 응답**에서 **응답 생성**을 선택합니다.

1. **HTTP 상태 코드**에 **400**을 입력합니다.

   이 응답에는 헤더를 설정하지 않습니다.

1. **저장**을 선택합니다.

1. 다음 단계를 반복하여 500 응답을 생성합니다.

   이 응답에는 헤더를 설정하지 않습니다.

Amazon S3의 통합 응답이 버킷 목록을 XML 페이로드로 반환하고 API Gateway의 기본 메서드 응답이 JSON 페이로드를 반환하므로, 백엔드 Content-Type 헤더 파라미터 값을 해당 프런트엔드 값에 매핑해야 합니다. 그렇지 않으면, 응답 본문이 실제로 XML 문자열일 경우 클라이언트는 콘텐츠 유형에 대한 `application/json`을 수신하게 됩니다. 다음 절차에서는 이렇게 설정하는 방법을 보여줍니다. 또한 클라이언트에게 Date 및 Content-Length같은 다른 헤더 파라미터를 표시하고자 합니다.

**GET / 메서드에 대한 응답 헤더 매핑 설정 방법**

1. **통합 응답** 탭의 **기본값 - 응답**에서 **편집**을 선택합니다.

1. **Content-Length** 헤더에서 매핑 값으로 **integration.response.header.Content-Length**를 입력합니다.

1. **Content-Type** 헤더에서 매핑 값으로 **integration.response.header.Content-Type**을 입력합니다.

1. **Timestamp** 헤더에서 매핑 값으로 **integration.response.header.Date**를 입력합니다.

1. **저장**을 선택합니다. 결과는 다음과 같습니다.

      
![\[메서드 응답 헤더에 통합 응답 헤더 매핑\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_setup_integration_response_headers_new_console.png)

1. **통합 응답** 탭의 **통합 응답**에서 **응답 생성**을 선택합니다.

1. **HTTP 상태 regex**에 **4\$1d\$12\$1**를 입력합니다. 이렇게 하면 모든 4xx HTTP 응답 상태 코드가 메서드 응답에 매핑됩니다.

1. **메서드 응답 상태 코드**에서 **400**을 선택합니다.

1. **생성(Create)**을 선택합니다.

1. 다음 단계를 반복하여 500 메서드 응답의 통합 응답을 생성합니다. **HTTP 상태 regex**에 **5\$1d\$12\$1**를 입력합니다.

지금까지 구성한 API를 테스트해 보는 것도 좋은 방법입니다.

**`GET /` 메서드를 테스트하는 방법**

1. **테스트** 탭을 선택합니다. 탭을 표시하려면 오른쪽 화살표 버튼을 선택해야 할 수도 있습니다.

1. **테스트**를 선택합니다. 결과는 다음 이미지와 같아야 합니다.

      
![\[API 루트 GET 버킷 결과 테스트\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_test_root_get_result_new_console.png)

## API 메서드를 노출하여 Amazon S3 버킷 액세스
<a name="api-folder-operations-as-s3-bucket-actions"></a>

Amazon S3 버킷을 사용하려면 /\$1folder\$1 리소스에서 `GET` 메서드를 노출하여 버킷의 객체를 나열합니다. 지침은 [API 메서드를 노출하여 호출자의 Amazon S3 버킷 나열](#api-root-get-as-s3-get-service) 단원에 설명한 지침과 비슷합니다. 더 많은 메서드를 보려면 [Amazon S3 프록시로 샘플 API의 OpenAPI 정의](api-as-s3-proxy-export-swagger-with-extensions.md)에서 샘플 API를 가져올 수 있습니다.

**폴더 리소스에 GET 메서드를 노출하려면**

1. **/\$1folder\$1** 리소스를 선택한 다음 **메서드 생성**을 선택합니다.

1. 메서드 유형에서 **GET**을 선택합니다.

1. **통합 유형**에서 **AWS 서비스**를 선택합니다.

1. **AWS 리전**에서 Amazon S3 버킷을 생성한 AWS 리전을 선택합니다.

1. **AWS 서비스**에서 **Amazon Simple Storage Service**를 선택합니다.

1. **AWS 하위 도메인**은 비워 둡니다.

1. **HTTP 메서드**에서 **GET**을 선택합니다.

1. **작업 유형**에서 **경로 재정의 사용**을 선택합니다.

1. **경로 재정의**에서 **\$1bucket\$1**를 입력합니다.

1. **실행 역할**에 **APIGatewayS3ProxyPolicy**의 ARN을 입력합니다.

1. **메서드 생성**을 선택합니다.

Amazon S3 엔드포인트 URL에 `{folder}` 경로 파라미터를 설정합니다. 메서드 요청의 `{folder}` 경로 파라미터를 통합 요청의 `{bucket}` 경로 파라미터에 매핑해야 합니다.

**`{folder}`를 `{bucket}`에 매핑하려면**

1.  **통합 요청** 탭의 **통합 요청 설정**에서 **편집**을 선택합니다.

1. **URL 경로 파라미터**를 선택한 다음 **경로 파라미터 추가**를 선택합니다.

1. **이름**에 **bucket**를 입력합니다.

1. **다음에서 매핑됨**에 **method.request.path.folder**을 입력합니다.

1. **저장**을 선택합니다.

이제 API를 테스트합니다.

**`/{folder} GET` 메서드를 테스트하려면**

1. **테스트** 탭을 선택합니다. 탭을 표시하려면 오른쪽 화살표 버튼을 선택해야 할 수도 있습니다.

1. **경로**의 **folder**에서 버킷 이름을 입력합니다.

1. **테스트**를 선택합니다.

   테스트 결과에는 버킷의 객체 목록이 포함됩니다.

      
![\[Amazon S3 버킷을 생성하는 GET 메서드를 테스트합니다.\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_test_api_folder_get_new_console.png)

## API 메서드를 노출하여 버킷에서 Amazon S3 객체 액세스
<a name="api-items-in-folder-as-s3-objects-in-bucket"></a>

Amazon S3에서는 지정된 버킷에서 객체를 액세스 및 관리하는 GET, DELETE, HEAD, OPTIONS, POST 및 PUT 작업을 지원합니다. 이 자습서에서는 `{folder}/{item}` 리소스에 `GET` 메서드를 노출하여 버킷에서 이미지를 가져옵니다. `{folder}/{item}` 리소스의 더 많은 적용 사례는 샘플 API를 참조하세요. [Amazon S3 프록시로 샘플 API의 OpenAPI 정의](api-as-s3-proxy-export-swagger-with-extensions.md) 

**아이템 리소스에 GET 메서드 노출**

1. **/\$1item\$1** 리소스를 선택한 다음 **메서드 생성**을 선택합니다.

1. 메서드 유형에서 **GET**을 선택합니다.

1. **통합 유형**에서 **AWS 서비스**를 선택합니다.

1. **AWS 리전**에서 Amazon S3 버킷을 생성한 AWS 리전을 선택합니다.

1. **AWS 서비스**에서 **Amazon Simple Storage Service**를 선택합니다.

1. **AWS 하위 도메인**은 비워 둡니다.

1. **HTTP 메서드**에서 **GET**을 선택합니다.

1. **작업 유형**에서 **경로 재정의 사용**을 선택합니다.

1. **경로 재정의**에 **\$1bucket\$1/\$1object\$1**를 입력합니다.

1. **실행 역할**에 **APIGatewayS3ProxyPolicy**의 ARN을 입력합니다.

1. **메서드 생성**을 선택합니다.

Amazon S3 엔드포인트 URL에 `{folder}` 및 `{item}` 경로 파라미터를 설정합니다. 메서드 요청의 경로 파라미터를 통합 요청의 경로 파라미터에 매핑해야 합니다.

이 단계에서는 다음 작업을 수행합니다.
+ 메서드 요청의 `{folder}` 경로 파라미터를 통합 요청의 `{bucket}` 경로 파라미터에 매핑합니다.
+ 메서드 요청의 `{item}` 경로 파라미터를 통합 요청의 `{object}` 경로 파라미터에 매핑합니다.

**`{folder}`를 `{bucket}`에 매핑하고 `{item}`을 `{object}`에 매핑하려면**

1.  **통합 요청** 탭의 **통합 요청 설정**에서 **편집**을 선택합니다.

1. **URL 경로 파라미터**를 선택합니다.

1. **경로 파라미터 추가**를 선택합니다.

1. **이름**에 **bucket**를 입력합니다.

1. **다음에서 매핑됨**에 **method.request.path.folder**을 입력합니다.

1. **경로 파라미터 추가**를 선택합니다.

1. **이름**에 **object**를 입력합니다.

1. **다음에서 매핑됨**에 **method.request.path.item**을 입력합니다.

1. **저장**을 선택합니다.

**`/{folder}/{object} GET` 메서드를 테스트하려면**

1. **테스트** 탭을 선택합니다. 탭을 표시하려면 오른쪽 화살표 버튼을 선택해야 할 수도 있습니다.

1. **경로**의 **folder**에서 버킷 이름을 입력합니다.

1. **경로**의 **item**에서 항목 이름을 입력합니다.

1. **테스트**를 선택합니다.

   응답 본문에는 항목의 콘텐츠가 포함됩니다.

      
![\[Amazon S3 버킷을 생성하는 GET 메서드를 테스트합니다.\]](http://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/images/aws_proxy_s3_test_api_item_get_new_console.png)

   이 요청은 (“Hello world”)의 일반 텍스트를 해당 Amazon S3 버킷(amzn-s3-demo-bucket)에 지정된 파일(test.txt)의 콘텐츠로 올바르게 반환합니다.

 API Gateway에서 utf-8 인코딩된 JSON 콘텐츠 이외의 것으로 간주되는 이진 파일을 다운로드 또는 업로드하려면 추가 API 설정이 필요합니다. 개략적으로 설명하면 다음과 같습니다.

**S3에서 이진 파일을 다운로드 또는 업로드하려면**

1.  해당 파일의 미디어 유형을 API의 binaryMediaTypes에 등록합니다. 이 작업은 콘솔에서 다음과 같이 수행할 수 있습니다.

   1. API에 대한 **API 설정**을 선택합니다.

   1. **이진 미디어 형식**에서 **미디어 형식 관리**를 선택합니다.

   1. **이진 미디어 형식 추가**를 선택한 다음 필요한 미디어 형식(예: `image/png`)을 입력합니다.

   1. **변경 사항 저장**을 선택하여 설정을 저장합니다.

1. `Content-Type`(업로드하는 경우) 및/또는 `Accept`(다운로드하는 경우) 헤더를 메서드 요청에 추가하여 클라이언트에게 필요한 이진 미디어 유형을 지정하고 통합 유형에 매핑하도록 요청합니다.

1. 통합 요청(업로드하는 경우) 및 통합 응답(다운로드하는 경우)에서 **콘텐츠 처리(Content Handling)**를 `Passthrough`로 설정합니다. 해당 콘텐츠 유형에 어떤 매핑 템플릿도 정의되어 있지 않은지 확인하십시오. 자세한 내용은 [API Gateway에서 REST API의 데이터 변환](rest-api-data-transformations.md) 섹션을 참조하세요.

페이로드 크기 제한은 10MB입니다. [REST API 구성 및 실행에 대한 API Gateway 할당량](api-gateway-execution-service-limits-table.md)을(를) 참조하세요.

Amazon S3에 저장된 파일에서 올바른 콘텐츠 유형이 파일의 메타데이터로 추가되어 있는지 확인하십시오. 스트리밍 가능한 미디어 콘텐츠의 경우, `Content-Disposition:inline`도 메타데이터에 추가되어야 할 수 있습니다.

API Gateway에서의 이진 지원에 대한 자세한 내용은 [API Gateway의 콘텐츠 유형 변환](api-gateway-payload-encodings-workflow.md) 단원을 참조하십시오.

# Amazon S3 프록시로 샘플 API의 OpenAPI 정의
<a name="api-as-s3-proxy-export-swagger-with-extensions"></a>

다음 OpenAPI 정의에서는 Amazon S3 프록시로 작동하는 API를 설명합니다. 이 API에는 자습서에서 생성한 API보다 더 많은 Amazon S3 작업이 포함되어 있습니다. OpenAPI 정의에는 다음과 같은 메서드가 노출되어 있습니다.
+ API의 루트 리소스에서 GET을 노출하여 [호출자의 모든 Amazon S3 버킷을 나열합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html).
+ 폴더 리소스에서 GET을 노출하여 [Amazon S3 버킷의 모든 객체 목록을 봅니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html).
+ 폴더 리소스에서 PUT을 노출하여 [Amazon S3에 버킷을 추가합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html).
+ 폴더 리소스에서 DELETE를 노출하여 [Amazon S3에서 버킷을 제거합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html).
+ 폴더/항목 리소스에서 GET을 노출하여 [Amazon S3 버킷에서 객체를 보거나 다운로드합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html).
+ 폴더/항목 리소스에서 PUT을 노출하여 [Amazon S3 버킷에 객체를 업로드합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html).
+ 폴더/항목 리소스에서 HEAD를 노출하여 [객체 메타데이터를 Amazon S3 버킷에 가져옵니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html).
+ 폴더/항목 리소스에서 DELETE를 노출하여 [Amazon S3 버킷에서 객체를 제거합니다](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html).

OpenAPI 정의를 사용하여 API를 가져오는 방법에 대한 지침은 [API Gateway에서 OpenAPI를 사용하여 REST API 개발](api-gateway-import-api.md) 단원을 참조하십시오.

유사한 API를 생성하는 방법에 대한 지침은 [자습서: Amazon Kinesis 프록시로 REST API 생성](integrating-api-with-aws-services-s3.md) 섹션을 참조하세요.

AWS IAM 권한 부여를 지원하는 [Postman](https://www.postman.com/)을 사용하여 이 API를 간접적으로 호출하는 방법은 [REST API 클라이언트를 사용하여 API 호출](api-as-s3-proxy-test-using-postman.md) 섹션을 참조하세요.

------
#### [ OpenAPI 2.0 ]

```
{
  "swagger": "2.0",
  "info": {
    "version": "2016-10-13T23:04:43Z",
    "title": "MyS3"
  },
  "host": "9gn28ca086.execute-api.{region}.amazonaws.com",
  "basePath": "/S3",
  "schemes": [
    "https"
  ],
  "paths": {
    "/": {
      "get": {
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Timestamp": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Content-Length": "integration.response.header.Content-Length",
                "method.response.header.Timestamp": "integration.response.header.Date"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path//",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "GET",
          "type": "aws"
        }
      }
    },
    "/{folder}": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Date": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Date": "integration.response.header.Date",
                "method.response.header.Content-Length": "integration.response.header.content-length"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.bucket": "method.request.path.folder"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "GET",
          "type": "aws"
        }
      },
      "put": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Content-Length": "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.bucket": "method.request.path.folder",
            "integration.request.header.Content-Type": "method.request.header.Content-Type"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "PUT",
          "type": "aws"
        }
      },
      "delete": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Date": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Date": "integration.response.header.Date"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.bucket": "method.request.path.folder"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "DELETE",
          "type": "aws"
        }
      }
    },
    "/{folder}/{item}": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "item",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "content-type": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.content-type": "integration.response.header.content-type",
                "method.response.header.Content-Type": "integration.response.header.Content-Type"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.object": "method.request.path.item",
            "integration.request.path.bucket": "method.request.path.folder"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "GET",
          "type": "aws"
        }
      },
      "head": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "item",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Content-Length": "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.object": "method.request.path.item",
            "integration.request.path.bucket": "method.request.path.folder"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "HEAD",
          "type": "aws"
        }
      },
      "put": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "required": false,
            "type": "string"
          },
          {
            "name": "item",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "integration.response.header.Content-Type",
                "method.response.header.Content-Length": "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.object": "method.request.path.item",
            "integration.request.path.bucket": "method.request.path.folder",
            "integration.request.header.Content-Type": "method.request.header.Content-Type"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "PUT",
          "type": "aws"
        }
      },
      "delete": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "item",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            },
            "headers": {
              "Content-Length": {
                "type": "string"
              },
              "Content-Type": {
                "type": "string"
              }
            }
          },
          "400": {
            "description": "400 response"
          },
          "500": {
            "description": "500 response"
          }
        },
        "security": [
          {
            "sigv4": []
          }
        ],
        "x-amazon-apigateway-integration": {
          "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "responses": {
            "4\\d{2}": {
              "statusCode": "400"
            },
            "default": {
              "statusCode": "200"
            },
            "5\\d{2}": {
              "statusCode": "500"
            }
          },
          "requestParameters": {
            "integration.request.path.object": "method.request.path.item",
            "integration.request.path.bucket": "method.request.path.folder"
          },
          "uri": "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "passthroughBehavior": "when_no_match",
          "httpMethod": "DELETE",
          "type": "aws"
        }
      }
    }
  },
  "securityDefinitions": {
    "sigv4": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header",
      "x-amazon-apigateway-authtype": "awsSigv4"
    }
  },
  "definitions": {
    "Empty": {
      "type": "object",
      "title": "Empty Schema"
    }
  }
}
```

------
#### [ OpenAPI 3.0 ]

```
{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "MyS3",
    "version" : "2016-10-13T23:04:43Z"
  },
  "servers" : [ {
    "url" : "https://9gn28ca086.execute-api.{region}.amazonaws.com/{basePath}",
    "variables" : {
      "basePath" : {
        "default" : "S3"
      }
    }
  } ],
  "paths" : {
    "/{folder}" : {
      "get" : {
        "parameters" : [ {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Date" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "GET",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Date" : "integration.response.header.Date",
                "method.response.header.Content-Length" : "integration.response.header.content-length"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.bucket" : "method.request.path.folder"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      },
      "put" : {
        "parameters" : [ {
          "name" : "Content-Type",
          "in" : "header",
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "PUT",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Content-Length" : "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.bucket" : "method.request.path.folder",
            "integration.request.header.Content-Type" : "method.request.header.Content-Type"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      },
      "delete" : {
        "parameters" : [ {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Date" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "DELETE",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Date" : "integration.response.header.Date"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.bucket" : "method.request.path.folder"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      }
    },
    "/{folder}/{item}" : {
      "get" : {
        "parameters" : [ {
          "name" : "item",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "content-type" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "GET",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.content-type" : "integration.response.header.content-type",
                "method.response.header.Content-Type" : "integration.response.header.Content-Type"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.object" : "method.request.path.item",
            "integration.request.path.bucket" : "method.request.path.folder"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      },
      "put" : {
        "parameters" : [ {
          "name" : "Content-Type",
          "in" : "header",
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "item",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "PUT",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Content-Length" : "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.object" : "method.request.path.item",
            "integration.request.path.bucket" : "method.request.path.folder",
            "integration.request.header.Content-Type" : "method.request.header.Content-Type"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      },
      "delete" : {
        "parameters" : [ {
          "name" : "item",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "DELETE",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200"
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.object" : "method.request.path.item",
            "integration.request.path.bucket" : "method.request.path.folder"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      },
      "head" : {
        "parameters" : [ {
          "name" : "item",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "folder",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "HEAD",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path/{bucket}/{object}",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Content-Length" : "integration.response.header.Content-Length"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "requestParameters" : {
            "integration.request.path.object" : "method.request.path.item",
            "integration.request.path.bucket" : "method.request.path.folder"
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      }
    },
    "/" : {
      "get" : {
        "responses" : {
          "400" : {
            "description" : "400 response",
            "content" : { }
          },
          "500" : {
            "description" : "500 response",
            "content" : { }
          },
          "200" : {
            "description" : "200 response",
            "headers" : {
              "Content-Length" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Timestamp" : {
                "schema" : {
                  "type" : "string"
                }
              },
              "Content-Type" : {
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Empty"
                }
              }
            }
          }
        },
        "x-amazon-apigateway-integration" : {
          "credentials" : "arn:aws:iam::123456789012:role/apigAwsProxyRole",
          "httpMethod" : "GET",
          "uri" : "arn:aws:apigateway:us-west-2:s3:path//",
          "responses" : {
            "4\\d{2}" : {
              "statusCode" : "400"
            },
            "default" : {
              "statusCode" : "200",
              "responseParameters" : {
                "method.response.header.Content-Type" : "integration.response.header.Content-Type",
                "method.response.header.Content-Length" : "integration.response.header.Content-Length",
                "method.response.header.Timestamp" : "integration.response.header.Date"
              }
            },
            "5\\d{2}" : {
              "statusCode" : "500"
            }
          },
          "passthroughBehavior" : "when_no_match",
          "type" : "aws"
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "Empty" : {
        "title" : "Empty Schema",
        "type" : "object"
      }
    }
  }
}
```

------

# REST API 클라이언트를 사용하여 API 호출
<a name="api-as-s3-proxy-test-using-postman"></a>

종합 자습서를 제공하기 위해 이제 AWS IAM 권한 부여를 지원하는 [Postman](https://www.postman.com/)을 사용하여 API를 호출하는 방법을 알아봅니다.<a name="api-as-s3-proxy-test-using-postman-steps"></a>

**Postman을 사용한 Amazon S3 프록시 API 호출 방법**

1. API를 배포 또는 재배포합니다. **단계 편집기(Stage Editor)** 상단의 **URL 호출(Invoke URL)** 옆에 표시된 API의 기본 URL를 적어 둡니다.

1. Postman을 시작합니다.

1. **권한 부여**(Authorization)를 선택한 다음 `AWS Signature`를 선택합니다. IAM 사용자의 액세스 키 ID 및 비밀 액세스 키를 각각 **AccessKey** 및 **SecretKey** 입력 필드에 입력합니다. API가 배포되는 AWS 리전을 **AWS 리전** 텍스트 상자에 입력합니다. **서비스 이름** 입력 필드에 `execute-api`를 입력합니다.

   IAM Management Console의 IAM 사용자 계정에 있는 **보안 자격 증명(Security Credentials)** 탭에서 키 페어를 생성할 수 있습니다.

1. `amzn-s3-demo-bucket`라는 버킷을 `{region}` 리전에 있는 Amazon S3 계정에 추가하려면:

   1. 드롭다운 메서드 목록에서 **PUT**을 선택하고 메서드 URL(`https://api-id.execute-api.aws-region.amazonaws.com/stage/folder-name`)을 입력합니다.

   1. `Content-Type` 헤더 값을 `application/xml`로 설정합니다. 콘텐츠 유형을 설정하기 전에 기존 헤더를 모두 삭제해야 할 수 있습니다.

   1. **본문** 메뉴 항목을 선택하고 다음의 XML 조각을 요청 본문으로 입력합니다.

      ```
      <CreateBucketConfiguration> 
        <LocationConstraint>{region}</LocationConstraint> 
      </CreateBucketConfiguration>
      ```

   1. **전송**을 선택하여 요청을 제출합니다. 성공한 경우 페이로드가 비어 있는 `200 OK` 응답을 수신하게 됩니다.

1. 위 지침에 따라 텍스트 파일을 버킷에 추가합니다. URL에서 **amzn-s3-demo-bucket**에 대해 `{folder}`의 버킷 이름을, **Readme.txt**에 대해 `{item}`의 파일 이름을 지정하고 파일 콘텐츠로(따라서 요청 페이로드가 됨) **Hello, World\$1**의 텍스트 문자열을 요청 페이로드로 제공하면 요청은 다음과 같이 됩니다.

   ```
   PUT /S3/amzn-s3-demo-bucket/Readme.txt HTTP/1.1
   Host: 9gn28ca086.execute-api.{region}.amazonaws.com
   Content-Type: application/xml
   X-Amz-Date: 20161015T062647Z
   Authorization: AWS4-HMAC-SHA256 Credential=access-key-id/20161015/{region}/execute-api/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=ccadb877bdb0d395ca38cc47e18a0d76bb5eaf17007d11e40bf6fb63d28c705b
   Cache-Control: no-cache
   Postman-Token: 6135d315-9cc4-8af8-1757-90871d00847e
   
   Hello, World!
   ```

   모든 것이 순조롭게 완료되면 비어 있는 페이로드가 포함된 `200 OK` 응답을 수신할 것입니다.

1. 방금 `Readme.txt` 버킷에 추가한 `amzn-s3-demo-bucket` 파일의 콘텐츠를 얻으려면 다음과 같이 GET 요청을 합니다.

   ```
   GET /S3/amzn-s3-demo-bucket/Readme.txt HTTP/1.1
   Host: 9gn28ca086.execute-api.{region}.amazonaws.com
   Content-Type: application/xml
   X-Amz-Date: 20161015T063759Z
   Authorization: AWS4-HMAC-SHA256 Credential=access-key-id/20161015/{region}/execute-api/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=ba09b72b585acf0e578e6ad02555c00e24b420b59025bc7bb8d3f7aed1471339
   Cache-Control: no-cache
   Postman-Token: d60fcb59-d335-52f7-0025-5bd96928098a
   ```

   성공한 경우 페이로드처럼 `200 OK` 텍스트 문자열이 포함된 `Hello, World!` 응답을 수신하게 됩니다.

1. `amzn-s3-demo-bucket` 버킷에 있는 항목을 나열하려면 다음의 요청을 제출합니다.

   ```
   GET /S3/amzn-s3-demo-bucket HTTP/1.1
   Host: 9gn28ca086.execute-api.{region}.amazonaws.com
   Content-Type: application/xml
   X-Amz-Date: 20161015T064324Z
   Authorization: AWS4-HMAC-SHA256 Credential=access-key-id/20161015/{region}/execute-api/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=4ac9bd4574a14e01568134fd16814534d9951649d3a22b3b0db9f1f5cd4dd0ac
   Cache-Control: no-cache
   Postman-Token: 9c43020a-966f-61e1-81af-4c49ad8d1392
   ```

   성공적으로 수행했을 경우, 이 요청을 제출하기 전에 더 많은 파일을 해당 버킷에 추가하지 않았다면, 지정된 버킷에 단일 항목을 보여 주는 XML 페이로드가 포함된 `200 OK` 응답을 수신하게 됩니다

   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
       <Name>apig-demo-5</Name>
       <Prefix></Prefix>
       <Marker></Marker>
       <MaxKeys>1000</MaxKeys>
       <IsTruncated>false</IsTruncated>
       <Contents>
           <Key>Readme.txt</Key>
           <LastModified>2016-10-15T06:26:48.000Z</LastModified>
           <ETag>"65a8e27d8879283831b664bd8b7f0ad4"</ETag>
           <Size>13</Size>
           <Owner>
               <ID>06e4b09e9d...603addd12ee</ID>
               <DisplayName>user-name</DisplayName>
           </Owner>
           <StorageClass>STANDARD</StorageClass>
       </Contents>
   </ListBucketResult>
   ```

**참고**  
이미지를 업로드하거나 다운로드하려면 콘텐츠 처리를 CONVERT\$1TO\$1BINARY로 설정해야 합니다.