Skip to content

How to use AWS CLI/SDK/API to describe a Resource Control Policy (RCP)?

0

Goal

Describe a manually-created Resource Control Policy (RCP) to understand the policy syntax that I should use with CloudFormation.

Problem

When looking at the docs for the aws organizations describe-resource-policy AWS CLI command, as well as docs for the equivalent AWS SDK and API, none of them list a request argument to provide the name or ID of an existing resource policy.

It's not just the online docs, either. Even with the latest version of the AWS CLI (aws-cli/2.24.3 Python/3.12.6 Darwin/23.5.0 exe/x86_64), the CLI output of aws organizations describe-resource-policy doesn't show any request options to provide a RCP name/id. Without this, the command fails to retrieve anything.

After manually viewing the RCP I created in the web console, I figured I could see the proper request arguments from CloudTrail. However, CloudTrail doesn't seem to log anything when I view an RCP in the web console... it only logs my attempts to use the AWS CLI which all showed an error code ofResourcePolicyNotFoundException since the CLI doesn't offer a way to request the RCP ID/name with thedescribe-resource-policy command.

Examples

The CLI and API docs below only show what the response looks like... there's no indication of how to request a specific RCP:

AWS CLI: aws organizations describe-resource-policy AWS CLI shows no args for RCP ID

AWS Organizations API: DescribeResourcePolicy Enter image description here

asked 2 years ago160 views

1 Answer
1
Accepted Answer

Issue was that I incorrectly assumed "DescribeResourcePolicy" was meant for a Resource Control Policy (RCP) but realized this is the API for the separate concept of an AWS Organization resource delegation policy.

RCPs can be created and viewed using the same Organizations API/CLI used with SCPs, i.e. DescribePolicy or CreatePolicy.

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.