-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(s3): server access logs (#5072)
* L2: enable server access logs in a S3 bucket use serverAccessLogs and reference the L1 construct directly through LazyValue * un-nested properties * Update bucket.ts * added integration tests * add AC to the log group in the integs * ACL support for logDelivery * updated the test to new format * Throw error if ACL would be changed while calling allowLogDelivery() * allowLogDelivery method moved to Bucket and made private * Bucket's accessControl is not anymore public * README entry and removed accessControl from the import Co-authored-by: Elad Ben-Israel <benisrae@amazon.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6c3d4c4
commit c9b074b
Showing
5 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"Resources": { | ||
"MyAccessLogsBucketF7FE6635": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"AccessControl": "LogDeliveryWrite" | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"MyBucketF68F3FF0": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"LoggingConfiguration": { | ||
"DestinationBucketName": { | ||
"Ref": "MyAccessLogsBucketF7FE6635" | ||
}, | ||
"LogFilePrefix": "example" | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env node | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as s3 from '../lib'; | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-s3-access-logs'); | ||
|
||
const accessLogBucket = new s3.Bucket(stack, 'MyAccessLogsBucket', { | ||
removalPolicy: cdk.RemovalPolicy.DESTROY, | ||
}); | ||
|
||
new s3.Bucket(stack, 'MyBucket', { | ||
serverAccessLogsBucket: accessLogBucket, | ||
serverAccessLogsPrefix: 'example', | ||
removalPolicy: cdk.RemovalPolicy.DESTROY, | ||
}); | ||
|
||
app.synth(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters