Skip to content

Creates a policy of a specified type that you can attach to a root, an organizational unit (OU), or an individual Amazon Web Services account

Description

Creates a policy of a specified type that you can attach to a root, an organizational unit (OU), or an individual Amazon Web Services account.

For more information about policies and their use, see Managing Organizations policies.

If the request includes tags, then the requester must have the organizations:TagResource permission.

You can only call this operation from the management account or a member account that is a delegated administrator.

Usage

organizations_create_policy(Content, Description, Name, Type, Tags)

Arguments

Value

A list with the following syntax:

list(
  Policy = list(
    PolicySummary = list(
      Id = "string",
      Arn = "string",
      Name = "string",
      Description = "string",
      Type = "SERVICE_CONTROL_POLICY"|"RESOURCE_CONTROL_POLICY"|"TAG_POLICY"|"BACKUP_POLICY"|"AISERVICES_OPT_OUT_POLICY"|"CHATBOT_POLICY"|"DECLARATIVE_POLICY_EC2"|"SECURITYHUB_POLICY"|"INSPECTOR_POLICY"|"UPGRADE_ROLLOUT_POLICY"|"BEDROCK_POLICY"|"S3_POLICY"|"NETWORK_SECURITY_DIRECTOR_POLICY"|"GUARDDUTY_POLICY",
      AwsManaged = TRUE|FALSE
    ),
    Content = "string"
  )
)

Request syntax

svc$create_policy(
  Content = "string",
  Description = "string",
  Name = "string",
  Type = "SERVICE_CONTROL_POLICY"|"RESOURCE_CONTROL_POLICY"|"TAG_POLICY"|"BACKUP_POLICY"|"AISERVICES_OPT_OUT_POLICY"|"CHATBOT_POLICY"|"DECLARATIVE_POLICY_EC2"|"SECURITYHUB_POLICY"|"INSPECTOR_POLICY"|"UPGRADE_ROLLOUT_POLICY"|"BEDROCK_POLICY"|"S3_POLICY"|"NETWORK_SECURITY_DIRECTOR_POLICY"|"GUARDDUTY_POLICY",
  Tags = list(
    list(
      Key = "string",
      Value = "string"
    )
  )
)

Examples

# The following example shows how to create a service control policy (SCP)
# that is named AllowAllS3Actions. The JSON string in the content
# parameter specifies the content in the policy. The parameter string is
# escaped with backslashes to ensure that the embedded double quotes in
# the JSON policy are treated as literals in the parameter, which itself
# is surrounded by double quotes:
# 
# 
svc$create_policy(
  Content = "{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"s3:*"}}",
  Description = "Enables admins of attached accounts to delegate all S3 permissions",
  Name = "AllowAllS3Actions",
  Type = "SERVICE_CONTROL_POLICY"
)