AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

ResourcePolicy

Resource Policy for CloudWatch Log Groups. Policies define the operations that are allowed on this resource. You almost never need to define this construct directly. All AWS resources that support resource policies have a method called `addToResourcePolicy()`, which will automatically create a new resource policy if one doesn't exist yet, otherwise it will add to the existing policy. Prefer to use `addToResourcePolicy()` instead.

Import

import { ResourcePolicy } from 'aws-cdk-lib/aws-logs';

Or use the module namespace:

import * as logs from 'aws-cdk-lib/aws-logs';
// logs.ResourcePolicy

Properties

Configuration passed to the constructor as ResourcePolicyProps.

policyStatementsOptional
PolicyStatement[]

Initial statements to add to the resource policy.

Default: - No statements

resourcePolicyNameOptional
string

Name of the log group resource policy.

Default: - Uses a unique id based on the construct path

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter