Amazon Directory Service examples using Amazon CLI - Amazon Command Line Interface
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Directory Service examples using Amazon CLI

The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Amazon Directory Service.

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios and cross-service examples.

Scenarios are code examples that show you how to accomplish a specific task by calling multiple functions within the same service.

Each example includes a link to GitHub, where you can find instructions on how to set up and run the code in context.

Topics

Actions

The following code example shows how to use describe-directories.

Amazon CLI

To get details about your directories

The following describe-directories example displays details about the specified directory.

aws ds describe-directories \ --directory-id d-a1b2c3d4e5

Output:

{ "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" ] } } } ] }

The following code example shows how to use describe-trusts.

Amazon CLI

To get details about your trust relationships

The following describe-trusts example displays details about the trust relationships for the specified directory.

aws ds describe-trusts \ --directory-id d-a1b2c3d4e5

Output:

{ "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" } ] }
  • For API details, see DescribeTrusts in Amazon CLI Command Reference.