Skip to main content

account_policies

Creates, updates, deletes or gets an account_policy resource or lists account_policies in a region

Overview

Nameaccount_policies
TypeResource
DescriptionThe AWS::Logs::AccountPolicy resource specifies a CloudWatch Logs AccountPolicy.
Idawscc.logs.account_policies

Fields

NameDatatypeDescription
account_idstringUser account id
policy_namestringThe name of the account policy
policy_documentstringThe body of the policy document you want to use for this topic.<br />You can only add one policy per PolicyType.<br />The policy must be in JSON string format.<br />Length Constraints: Maximum length of 30720
policy_typestringType of the policy.
scopestringScope for policy application
selection_criteriastringLog group selection criteria to apply policy only to a subset of log groups. SelectionCriteria string can be up to 25KB and cloudwatchlogs determines the length of selectionCriteria by using its UTF-8 bytes
regionstringAWS region.

For more information, see AWS::Logs::AccountPolicy.

Methods

NameAccessible byRequired Params
create_resourceINSERTPolicyName, PolicyType, PolicyDocument, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all properties from an individual account_policy.

SELECT
region,
account_id,
policy_name,
policy_document,
policy_type,
scope,
selection_criteria
FROM awscc.logs.account_policies
WHERE region = 'us-east-1' AND data__Identifier = '<AccountId>|<PolicyType>|<PolicyName>';

INSERT example

Use the following StackQL query and manifest file to create a new account_policy resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.logs.account_policies (
PolicyName,
PolicyDocument,
PolicyType,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyDocument }}',
'{{ PolicyType }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM awscc.logs.account_policies
WHERE data__Identifier = '<AccountId|PolicyType|PolicyName>'
AND region = 'us-east-1';

Permissions

To operate on the account_policies resource, the following permissions are required:

Create

logs:PutAccountPolicy,
logs:PutIndexPolicy,
logs:PutDataProtectionPolicy,
logs:DescribeAccountPolicies,
logs:CreateLogDelivery,
s3:REST.PUT.OBJECT,
firehose:TagDeliveryStream,
logs:PutSubscriptionFilter,
logs:DeleteSubscriptionFilter,
logs:PutTransformer,
logs:PutMetricExtractionPolicy,
iam:PassRole

Read

logs:DescribeAccountPolicies,
logs:GetTransformer,
logs:GetMetricExtractionPolicy

Update

logs:PutAccountPolicy,
logs:PutIndexPolicy,
logs:PutDataProtectionPolicy,
logs:DescribeAccountPolicies,
logs:DeleteAccountPolicy,
logs:DeleteIndexPolicy,
logs:DeleteDataProtectionPolicy,
logs:CreateLogDelivery,
logs:PutSubscriptionFilter,
logs:DeleteSubscriptionFilter,
logs:PutTransformer,
logs:DeleteTransformer,
logs:PutMetricExtractionPolicy,
logs:DeleteMetricExtractionPolicy,
s3:REST.PUT.OBJECT,
firehose:TagDeliveryStream,
iam:PassRole

Delete

logs:DeleteAccountPolicy,
logs:DeleteIndexPolicy,
logs:DeleteDataProtectionPolicy,
logs:DescribeAccountPolicies,
logs:DeleteSubscriptionFilter,
logs:DeleteTransformer,
logs:DeleteMetricExtractionPolicy,
iam:PassRole

List

logs:DescribeAccountPolicies,
logs:GetTransformer,
logs:GetMetricExtractionPolicy