

# AWS CLI를 사용한 Storage Gateway 예시
<a name="cli_storage-gateway_code_examples"></a>

다음 코드 예시는 Storage Gateway와 함께 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

**Topics**
+ [작업](#actions)

## 작업
<a name="actions"></a>

### `describe-gateway-information`
<a name="storage-gateway_DescribeGatewayInformation_cli_topic"></a>

다음 코드 예시에서는 `describe-gateway-information`의 사용 방법을 보여줍니다.

**AWS CLI**  
**게이트웨이 설명**  
다음 `describe-gateway-information` 명령은 지정된 게이트웨이에 대한 메타데이터를 반환합니다. 설명할 게이트웨이를 지정하려면 명령에서 게이트웨이의 Amazon 리소스 이름(ARN)을 사용합니다.  
이 예시에서는 계정 `sgw-12A3456B`에 ID가 `123456789012`인 게이트웨이를 지정합니다.  

```
aws storagegateway describe-gateway-information --gateway-arn "arn:aws:storagegateway:us-west-2:123456789012:gateway/sgw-12A3456B"
```
이 명령은 게이트웨이의 이름, 네트워크 인터페이스, 구성된 시간대 및 상태(게이트웨이가 실행 중인지 여부) 등 게이트웨이에 대한 메타데이터를 반환합니다.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeGatewayInformation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/storagegateway/describe-gateway-information.html)을 참조하세요.

### `list-file-shares`
<a name="storage-gateway_ListFileShares_cli_topic"></a>

다음 코드 예시에서는 `list-file-shares`의 사용 방법을 보여줍니다.

**AWS CLI**  
**파일 공유 나열**  
다음 `command-name` 예시에서는 AWS 계정에서 사용 가능한 위젯을 나열합니다.  

```
aws storagegateway list-file-shares \
    --gateway-arn arn:aws:storagegateway:us-east-1:209870788375:gateway/sgw-FB02E292
```
출력:  

```
{
    "FileShareInfoList": [
        {
            "FileShareType": "NFS",
            "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345",
            "FileShareId": "share-2FA12345",
            "FileShareStatus": "AVAILABLE",
            "GatewayARN": "arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-FB0AAAAA"
        }
    ],
    "Marker": null
}
```
자세한 내용은 *AWS Storage Gateway Service API 참조*의 [ListFileShares](https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_ListFileShares.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListFileShares](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/storagegateway/list-file-shares.html)를 참조하세요.

### `list-gateways`
<a name="storage-gateway_ListGateways_cli_topic"></a>

다음 코드 예시에서는 `list-gateways`의 사용 방법을 보여줍니다.

**AWS CLI**  
**계정의 게이트웨이 나열**  
다음 `list-gateways` 명령은 계정에 정의된 모든 게이트웨이를 나열합니다.  

```
aws storagegateway list-gateways
```
이 명령은 게이트웨이의 Amazon 리소스 이름(ARN) 목록을 포함하는 JSON 블록을 출력합니다.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListGateways](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/storagegateway/list-gateways.html)를 참조하세요.

### `list-volumes`
<a name="storage-gateway_ListVolumes_cli_topic"></a>

다음 코드 예시에서는 `list-volumes`의 사용 방법을 보여줍니다.

**AWS CLI**  
**게이트웨이에 대해 구성된 볼륨 나열**  
다음 `list-volumes` 명령은 지정된 게이트웨이에 대해 구성된 볼륨 목록을 반환합니다. 설명할 게이트웨이를 지정하려면 명령에서 게이트웨이의 Amazon 리소스 이름(ARN)을 사용합니다.  
이 예시에서는 계정 `sgw-12A3456B`에 ID가 `123456789012`인 게이트웨이를 지정합니다.  

```
aws storagegateway list-volumes --gateway-arn "arn:aws:storagegateway:us-west-2:123456789012:gateway/sgw-12A3456B"
```
이 명령은 각 볼륨의 유형과 ARN이 있는 볼륨 목록을 포함하는 JSON 블록을 출력합니다.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListVolumes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/storagegateway/list-volumes.html)를 참조하세요.

### `refresh-cache`
<a name="storage-gateway_RefreshCache_cli_topic"></a>

다음 코드 예시에서는 `refresh-cache`의 사용 방법을 보여줍니다.

**AWS CLI**  
**파일 공유 캐시 새로 고치기**  
다음 `refresh-cache` 예시에서는 지정된 파일 공유의 캐시를 새로 고칩니다.  

```
aws storagegateway refresh-cache \
    --file-share-arn arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345
```
출력:  

```
{
    "FileShareARN": "arn:aws:storagegateway:us-east-1:111122223333:share/share-2FA12345",
    "NotificationId": "4954d4b1-abcd-ef01-1234-97950a7d3483"
}
```
자세한 내용은 *AWS Storage Gateway Service API 참조*의 [ListFileShares](https://docs.aws.amazon.com/storagegateway/latest/APIReference/API_RefreshCache.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [RefreshCache](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/storagegateway/refresh-cache.html)를 참조하세요.