How to do it...

  1. Open a new file in your text editor, add your JSON policy document, and save it.
  2. Run the create-policy CLI command like so. We're getting a little tricky with the tr command here: we're using it to remove the carriage returns from the policy document, so pay close attention to the syntax in the example provided. Unfortunately, the organizations CLI doesn't allow us to provide the path to the policy document directly:
        aws organizations create-policy \          --content "$(tr -d '\n' < my-policy-file.json)" \           --description "A policy description goes here" \          --name "My policy" \          --type SERVICE_CONTROL_POLICY
  1. If the preceding CLI command works successfully, some JSON will be returned to you containing the ID of the policy we just ...

Get AWS Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.