diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts index cffea2b29c903..9ab660d362df5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts @@ -4,7 +4,6 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as s3 from 'aws-cdk-lib/aws-s3'; import * as logs from 'aws-cdk-lib/aws-logs'; -import { RetentionDays } from 'aws-cdk-lib/aws-logs'; import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from 'aws-cdk-lib/custom-resources'; import { STANDARD_CUSTOM_RESOURCE_PROVIDER_RUNTIME } from '../../config'; @@ -42,7 +41,7 @@ class TestStack extends Stack { autoDeleteObjects: true, autoDeleteObjectsLogGroup: new logs.LogGroup(this, 'LogGroup', { logGroupName: 'AutoDeleteObjectsLambdaLogs', - retention: RetentionDays.THREE_DAYS, + retention: logs.RetentionDays.THREE_DAYS, }), }); diff --git a/packages/aws-cdk-lib/aws-s3/README.md b/packages/aws-cdk-lib/aws-s3/README.md index f24c68232e516..e6d7e02d2648a 100644 --- a/packages/aws-cdk-lib/aws-s3/README.md +++ b/packages/aws-cdk-lib/aws-s3/README.md @@ -627,15 +627,14 @@ When `autoDeleteObjects` is enabled, `s3:PutBucketPolicy` is added to the bucket Pass a custom log group via the `autoDeleteObjectsLogGroup` option, which will be used by the custom resource lambda. ```ts -import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs'; +import { ILogGroup } from 'aws-cdk-lib/aws-logs'; + +declare const logGroup: ILogGroup; const bucket = new s3.Bucket(this, 'MyTempFileBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY, autoDeleteObjects: true, - autoDeleteObjectsLogGroup: new LogGroup(this, 'LogGroup', { - logGroupName: 'MyLogGroup', - retention: RetentionDays.TWO_YEARS - }) + autoDeleteObjectsLogGroup: logGroup }); ``` diff --git a/packages/aws-cdk-lib/aws-s3/lib/bucket.ts b/packages/aws-cdk-lib/aws-s3/lib/bucket.ts index 68ee10db65131..a4e9dbfcc6ca9 100644 --- a/packages/aws-cdk-lib/aws-s3/lib/bucket.ts +++ b/packages/aws-cdk-lib/aws-s3/lib/bucket.ts @@ -10,7 +10,7 @@ import { parseBucketArn, parseBucketName } from './util'; import * as events from '../../aws-events'; import * as iam from '../../aws-iam'; import * as kms from '../../aws-kms'; -import * as logs from '../../aws-logs/index'; +import * as logs from '../../aws-logs'; import { CustomResource, Duration, diff --git a/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts b/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts index 2bab43ece400b..c893072cab472 100644 --- a/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts +++ b/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts @@ -3,7 +3,7 @@ import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { Annotations, Match, Template } from '../../assertions'; import * as iam from '../../aws-iam'; import * as kms from '../../aws-kms'; -import { LogGroup } from '../../aws-logs'; +import * as logs from '../../aws-logs'; import * as cdk from '../../core'; import * as s3 from '../lib'; @@ -3470,7 +3470,7 @@ describe('bucket', () => { new s3.Bucket(stack, 'MyBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY, autoDeleteObjects: true, - autoDeleteObjectsLogGroup: new LogGroup(stack, 'LogGroup1', { + autoDeleteObjectsLogGroup: new logs.LogGroup(stack, 'LogGroup1', { logGroupName: 'MyLogGroup', }), });