Skip to content

Commit 0ed5e85

Browse files
authored
chore(ec2): enforceSSL on flowLog s3 bucket (#18271)
could pass another bucket, but automatically created buckets are convenient/popular, so worth improving defaults https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.FlowLog.html https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html --- ```sh # updated integ snapshots packages/@aws-cdk/aws-ec2 $ /workspace/aws-cdk/tools/\@aws-cdk/cdk-integ-tools/bin/cdk-integ --dry-run ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ad7374a commit 0ed5e85

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class S3Destination extends FlowLogDestination {
198198
if (this.props.s3Bucket === undefined) {
199199
s3Bucket = new s3.Bucket(scope, 'Bucket', {
200200
encryption: s3.BucketEncryption.UNENCRYPTED,
201+
enforceSSL: true,
201202
removalPolicy: RemovalPolicy.RETAIN,
202203
});
203204
} else {

packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.expected.json

+47
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,53 @@
527527
"UpdateReplacePolicy": "Retain",
528528
"DeletionPolicy": "Retain"
529529
},
530+
"VPCFlowLogsS3BucketPolicyB2C2A045": {
531+
"Type": "AWS::S3::BucketPolicy",
532+
"Properties": {
533+
"Bucket": {
534+
"Ref": "VPCFlowLogsS3BucketFB7DC2BE"
535+
},
536+
"PolicyDocument": {
537+
"Statement": [
538+
{
539+
"Action": "s3:*",
540+
"Condition": {
541+
"Bool": {
542+
"aws:SecureTransport": "false"
543+
}
544+
},
545+
"Effect": "Deny",
546+
"Principal": {
547+
"AWS": "*"
548+
},
549+
"Resource": [
550+
{
551+
"Fn::GetAtt": [
552+
"VPCFlowLogsS3BucketFB7DC2BE",
553+
"Arn"
554+
]
555+
},
556+
{
557+
"Fn::Join": [
558+
"",
559+
[
560+
{
561+
"Fn::GetAtt": [
562+
"VPCFlowLogsS3BucketFB7DC2BE",
563+
"Arn"
564+
]
565+
},
566+
"/*"
567+
]
568+
]
569+
}
570+
]
571+
}
572+
],
573+
"Version": "2012-10-17"
574+
}
575+
}
576+
},
530577
"VPCFlowLogsS3FlowLogB5256CFF": {
531578
"Type": "AWS::EC2::FlowLog",
532579
"Properties": {

0 commit comments

Comments
 (0)