AWS News Blog

Now Available – AWS Directory Service API & CLI (Bonus: CloudTrail Integration)

AWS Directory Service allows you to connect your AWS resources to an existing on-premises Active Directory or to set up a new, standalone directory in the AWS Cloud (see my post, New AWS Directory Service, to learn more).

Until today, all operations on a Directory were initiated through the AWS Management Console. This was convenient, but was not ideal for integration with existing workflows.

Today we are making Directory Service even more useful by adding API and CLI (Command-Line Interface) support. You can now create and delete directories, computer accounts, and aliases (alternate names for the directory). You can create snapshot backups for standalone directories, and you can manage sign-on modes (Radius and SSO).

You can use an IAM policy to grant permission to perform the API actions.

Let’s take a look at some sample requests and responses, starting with a call to CreateDirectory. Here is the request:

{"Name": "",
 "ShortName": "corp",
 "Password": "Westbay@123",
 "Description": "corp",
 "Size": "Large",
  {"VpcId": "vpc-c3dd04a2",
    ["subnet-9add04fb", "subnet-66dc0507"]

And here is the response:

{"DirectoryId": "d-90673058d7"}

Here’s a call to DescribeDirectories, with three Directory Ids as arguments:

  ["d-9067315087", "d-9067312ba4", "d-906731a3f3"]

The response is fairly long; it starts like this:

    {"AccessUrl": "", 
     "Alias": "d-9067312ba4", 
     "DirectoryId": "d-9067312ba4", 
      ["", ""], 
     "LaunchTime": 1430175177.892, 
     "Name": "", 
     "ShortName": "Eastbay", 
     "Size": "Large", 
     "SsoEnabled": false, 
     "Stage": "Active", 
     "StageLastUpdatedDateTime": 1430175333.603, 
     "Type": "SimpleAD", 
        ["us-east-1a", "us-east-1e"], 
        ["subnet-9add04fb", "subnet-13773d29"], 
       "VpcId": "vpc-c3dd04a2"}

CloudTrail Integration
Directory Service API actions (via an SDK, the Console, or the CLI) can now be recorded via AWS CloudTrail.

Learn More
To learn more, read the new AWS Directory Service API Developer Guide. You can download the AWS SDKs and the AWS Command Line Interface (AWS CLI) to get started.


Jeff Barr

Jeff Barr

Jeff Barr is Chief Evangelist for AWS. He started this blog in 2004 and has been writing posts just about non-stop ever since.