

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. [AWS](https://github.com/awsdocs/aws-doc-sdk-examples) 

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

# AWS SDKs Directory Service 사용에 대한 코드 예제
<a name="directory-service_code_examples"></a>

다음 코드 예제에서는 AWS 소프트웨어 개발 키트(SDK)와 AWS Directory Service 함께를 사용하는 방법을 보여줍니다.

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

**추가 리소스**
+  **[Directory Service 관리 가이드](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/what_is.html)** -에 대한 자세한 정보입니다 Directory Service.
+ **[Directory Service API 참조](https://docs.aws.amazon.com/directoryservice/latest/APIReference/Welcome.html)** - 사용 가능한 모든 Directory Service 작업에 대한 세부 정보입니다.
+ **[AWS 개발자 센터](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23)** - 범주 또는 전체 텍스트 검색을 기준으로 필터링할 수 있는 코드 예제입니다.
+ **[AWS SDK 예제](https://github.com/awsdocs/aws-doc-sdk-examples)** - 기본 언어로 된 전체 코드가 포함된 GitHub 리포지토리. 코드 설정 및 실행을 위한 지침이 포함되어 있습니다.

**Contents**
+ [기본 사항](directory-service_code_examples_basics.md)
  + [작업](directory-service_code_examples_actions.md)
    + [`DescribeDirectories`](directory-service_example_directory-service_DescribeDirectories_section.md)
    + [`DescribeTrusts`](directory-service_example_directory-service_DescribeTrusts_section.md)

# AWS SDKs Directory Service 사용에 대한 기본 예제
<a name="directory-service_code_examples_basics"></a>

다음 코드 예제에서는 AWS Directory Service SDKs에서의 기본 사항을 AWS 사용하는 방법을 보여줍니다.

**Contents**
+ [작업](directory-service_code_examples_actions.md)
  + [`DescribeDirectories`](directory-service_example_directory-service_DescribeDirectories_section.md)
  + [`DescribeTrusts`](directory-service_example_directory-service_DescribeTrusts_section.md)

# AWS SDKs Directory Service 를 사용하기 위한 작업
<a name="directory-service_code_examples_actions"></a>

다음 코드 예제에서는 AWS SDKs를 사용하여 개별 Directory Service 작업을 수행하는 방법을 보여줍니다. 각 예시에는 GitHub에 대한 링크가 포함되어 있습니다. 여기에서 코드 설정 및 실행에 대한 지침을 찾을 수 있습니다.

 다음 예제에는 가장 일반적으로 사용되는 작업만 포함되어 있습니다. 전체 목록은 [AWS Directory Service API 참조](https://docs.aws.amazon.com/directoryservice/latest/APIReference/Welcome.html)를 참조하세요.

**Topics**
+ [`DescribeDirectories`](directory-service_example_directory-service_DescribeDirectories_section.md)
+ [`DescribeTrusts`](directory-service_example_directory-service_DescribeTrusts_section.md)

# CLI로 `DescribeDirectories` 사용
<a name="directory-service_example_directory-service_DescribeDirectories_section"></a>

다음 코드 예시는 `DescribeDirectories`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**디렉터리에 대한 세부 정보를 가져오려면**  
다음 `describe-directories` 예제에서는 지정된 디렉터리에 대한 세부 정보를 표시합니다.  

```
aws ds describe-directories \
   --directory-id d-a1b2c3d4e5
```
출력:  

```
{
    "DirectoryDescriptions": [
        {
            "DirectoryId": "d-a1b2c3d4e5",
            "Name": "mydirectory.example.com",
            "ShortName": "mydirectory",
            "Size": "Small",
            "Edition": "Standard",
            "Alias": "d-a1b2c3d4e5",
            "AccessUrl": "d-a1b2c3d4e5.awsapps.com",
            "Stage": "Active",
            "ShareStatus": "Shared",
            "ShareMethod": "HANDSHAKE",
            "ShareNotes": "These are my share notes",
            "LaunchTime": "2019-07-08T15:33:46.327000-07:00",
            "StageLastUpdatedDateTime": "2019-07-08T15:59:12.307000-07:00",
            "Type": "SharedMicrosoftAD",
            "SsoEnabled": false,
            "DesiredNumberOfDomainControllers": 0,
            "OwnerDirectoryDescription": {
                "DirectoryId": "d-b2c3d4e5f6",
                "AccountId": "123456789111",
                "DnsIpAddrs": [
                    "203.113.0.248",
                    "203.113.0.253"
                ],
                "VpcSettings": {
                    "VpcId": "vpc-a1b2c3d4",
                    "SubnetIds": [
                        "subnet-a1b2c3d4",
                        "subnet-d4c3b2a1"
                    ],
                    "AvailabilityZones": [
                        "us-west-2a",
                        "us-west-2c"
                    ]
                }
            }
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeDirectories](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ds/describe-directories.html)를 참조하세요.

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**예제 1: 이 명령에서는 이 계정에 속한 디렉터리의 정보를 가져옵니다.**  

```
Get-DSDirectory | Select-Object DirectoryId, Name, DnsIpAddrs, Type
```
**출력:**  

```
DirectoryId  Name           DnsIpAddrs                     Type
-----------  ----           ----------                     ----
d-123456abcd abcd.example.com {172.31.74.189, 172.31.13.145} SimpleAD
d-123456efgh wifi.example.com {172.31.16.108, 172.31.10.56}  ADConnector
d-123456ijkl lan2.example.com {172.31.10.56, 172.31.16.108}  MicrosoftAD
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V4)*의 [DescribeDirectories](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for PowerShell V5**  
**예제 1: 이 명령에서는 이 계정에 속한 디렉터리의 정보를 가져옵니다.**  

```
Get-DSDirectory | Select-Object DirectoryId, Name, DnsIpAddrs, Type
```
**출력:**  

```
DirectoryId  Name           DnsIpAddrs                     Type
-----------  ----           ----------                     ----
d-123456abcd abcd.example.com {172.31.74.189, 172.31.13.145} SimpleAD
d-123456efgh wifi.example.com {172.31.16.108, 172.31.10.56}  ADConnector
d-123456ijkl lan2.example.com {172.31.10.56, 172.31.16.108}  MicrosoftAD
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V5)*의 [DescribeDirectories](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------

# CLI로 `DescribeTrusts` 사용
<a name="directory-service_example_directory-service_DescribeTrusts_section"></a>

다음 코드 예시는 `DescribeTrusts`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**신뢰 관계에 대한 세부 정보를 가져오려면**  
다음 `describe-trusts` 예제에서는 지정된 디렉터리의 신뢰 관계에 대한 세부 정보를 표시합니다.  

```
aws ds describe-trusts \
   --directory-id d-a1b2c3d4e5
```
출력:  

```
{
    "Trusts": [
        {
            "DirectoryId": "d-a1b2c3d4e5",
            "TrustId": "t-9a8b7c6d5e",
            "RemoteDomainName": "other.example.com",
            "TrustType": "Forest",
            "TrustDirection": "Two-Way",
            "TrustState": "Verified",
            "CreatedDateTime": "2017-06-20T18:08:45.614000-07:00",
            "LastUpdatedDateTime": "2019-06-04T10:52:12.410000-07:00",
            "StateLastUpdatedDateTime": "2019-06-04T10:52:12.410000-07:00",
            "SelectiveAuth": "Disabled"
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeTrusts](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ds/describe-trusts.html)를 참조하세요.

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**예제 1: 이 명령에서는 지정된 directory-id에 대해 생성된 신뢰 관계 정보를 가져옵니다.**  

```
Get-DSTrust -DirectoryId d-123456abcd
```
**출력:**  

```
CreatedDateTime          : 7/5/2019 4:55:42 AM
DirectoryId              : d-123456abcd
LastUpdatedDateTime      : 7/5/2019 4:56:04 AM
RemoteDomainName         : contoso.com
SelectiveAuth            : Disabled
StateLastUpdatedDateTime : 7/5/2019 4:56:04 AM
TrustDirection           : One-Way: Incoming
TrustId                  : t-9067157123
TrustState               : Created
TrustStateReason         :
TrustType                : Forest
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V4)*의 [DescribeTrusts](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for PowerShell V5**  
**예제 1: 이 명령에서는 지정된 directory-id에 대해 생성된 신뢰 관계 정보를 가져옵니다.**  

```
Get-DSTrust -DirectoryId d-123456abcd
```
**출력:**  

```
CreatedDateTime          : 7/5/2019 4:55:42 AM
DirectoryId              : d-123456abcd
LastUpdatedDateTime      : 7/5/2019 4:56:04 AM
RemoteDomainName         : contoso.com
SelectiveAuth            : Disabled
StateLastUpdatedDateTime : 7/5/2019 4:56:04 AM
TrustDirection           : One-Way: Incoming
TrustId                  : t-9067157123
TrustState               : Created
TrustStateReason         :
TrustType                : Forest
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V5)*의 [DescribeTrusts](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------