Skip to main content

rg policy

Manage resource group policies

Run ecctl rg policy <action> -h for usage, or ecctl schema rg.policy.<action> --full for the complete, agent-readable spec of every parameter and behavior.

create

ecctl rg policy create [flags]

Create policy

  • Kind: mutation · Risk: medium
APIWhen calledPurpose
CreatePolicyEvery time the command runs.Perform the resource operation.
ParameterTypeRequiredDescription
--namestringpolicy name
--policy-documentstringpolicy document JSON or @file
--regionstringAlibaba Cloud region
--descriptionstringpolicy description

delete

ecctl rg policy delete <name> [flags]

Delete policy

  • Kind: mutation · Risk: high
APIWhen calledPurpose
DeletePolicyEvery time the command runs.Perform the resource operation.
ParameterTypeRequiredDescription
--regionstringAlibaba Cloud region

get

ecctl rg policy get <name> [flags]

Get policy

  • Kind: read · Risk: low
APIWhen calledPurpose
GetPolicyEvery time the command runs.Read the resource view.
ParameterTypeRequiredDescription
--policy-typestringpolicy type
--regionstringAlibaba Cloud region
--fieldsstringcomma-separated resource fields to include
--languagestringlanguage for policy description

list

ecctl rg policy list [flags]

List policies

  • Kind: read · Risk: low
APIWhen calledPurpose
ListPoliciesWhen --resource-group is not specified and --principal-type is not specified and --principal-name is not specified.Read the resource view.
ListPolicyAttachmentsWhen --resource-group is specified or --principal-type is specified or --principal-name is specified.Read the resource view.
ParameterTypeRequiredDescription
--regionstringAlibaba Cloud region
--fieldsstringcomma-separated resource fields to include
--filterkey_valuefilter expression key=value
--languagestringlanguage for policy description
--limitintegermaximum resources to return (default: 100)
--pageintegerresults page to return (default: 1)
--principal-namestringprincipal name
--principal-typestringprincipal type
--resource-groupstringresource group ID

attach

ecctl rg policy attach <name> [flags]

Attach policy to a principal

  • Kind: mutation · Risk: medium
  • Synchronous: waits for present (waiter attached_after_attach, timeout 300s); use --no-wait to skip.
APIWhen calledPurpose
AttachPolicyEvery time the command runs.Perform the resource operation.
ListPolicyAttachmentsWhen --no-wait is not specified.Poll until the resource reaches the target state. (repeated)
ParameterTypeRequiredDescription
--policy-typestringpolicy type
--principal-namestringprincipal name
--principal-typestringprincipal type
--regionstringAlibaba Cloud region
--resource-groupstringresource group ID

detach

ecctl rg policy detach <name> [flags]

Detach policy from a principal

  • Kind: mutation · Risk: medium
  • Synchronous: waits for absent (waiter detached_after_detach, timeout 300s); use --no-wait to skip.
APIWhen calledPurpose
DetachPolicyEvery time the command runs.Perform the resource operation.
ListPolicyAttachmentsWhen --no-wait is not specified.Poll until the resource reaches the target state. (repeated)
ParameterTypeRequiredDescription
--policy-typestringpolicy type
--principal-namestringprincipal name
--principal-typestringprincipal type
--regionstringAlibaba Cloud region
--resource-groupstringresource group ID