Skip to content

Commit 565971d

Browse files
authored
Merge branch 'main' into TheRealAmazonKendra/v1-init-templates
2 parents 8147860 + b025abc commit 565971d

14 files changed

Lines changed: 505 additions & 64 deletions

File tree

.github/workflows/issue-reprioritization.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: issue-reprioritization
2-
on:
2+
on:
3+
workflow_dispatch: {}
34
schedule:
45
- cron: "0 0 * * 0"
56

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,23 @@ export abstract class FlowLogResourceType {
9999
public abstract resourceId: string;
100100
}
101101

102+
/**
103+
* The file format for flow logs written to an S3 bucket destination
104+
*/
105+
export enum FlowLogFileFormat {
106+
/**
107+
* File will be written as plain text
108+
*
109+
* This is the default value
110+
*/
111+
PLAIN_TEXT = 'plain-text',
112+
113+
/**
114+
* File will be written in parquet format
115+
*/
116+
PARQUET = 'parquet',
117+
}
118+
102119
/**
103120
* Options for writing logs to a S3 destination
104121
*/
@@ -110,6 +127,20 @@ export interface S3DestinationOptions {
110127
* @default false
111128
*/
112129
readonly hiveCompatiblePartitions?: boolean;
130+
131+
/**
132+
* The format for the flow log
133+
*
134+
* @default FlowLogFileFormat.PLAIN_TEXT
135+
*/
136+
readonly fileFormat?: FlowLogFileFormat;
137+
138+
/**
139+
* Partition the flow log per hour
140+
*
141+
* @default false
142+
*/
143+
readonly perHourPartition?: boolean;
113144
}
114145

115146
/**
@@ -287,7 +318,13 @@ class S3Destination extends FlowLogDestination {
287318
logDestinationType: FlowLogDestinationType.S3,
288319
s3Bucket,
289320
keyPrefix: this.props.keyPrefix,
290-
destinationOptions: this.props.destinationOptions,
321+
destinationOptions: (this.props.destinationOptions?.fileFormat || this.props.destinationOptions?.perHourPartition
322+
|| this.props.destinationOptions?.hiveCompatiblePartitions)
323+
? {
324+
fileFormat: this.props.destinationOptions.fileFormat ?? FlowLogFileFormat.PLAIN_TEXT,
325+
perHourPartition: this.props.destinationOptions.perHourPartition ?? false,
326+
hiveCompatiblePartitions: this.props.destinationOptions.hiveCompatiblePartitions ?? false,
327+
} : undefined,
291328
};
292329
}
293330
}
@@ -473,5 +510,6 @@ export class FlowLog extends FlowLogBase {
473510
});
474511

475512
this.flowLogId = flowLog.ref;
513+
this.node.defaultChild = flowLog;
476514
}
477515
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ class FeatureFlagStack extends Stack {
2020
this.bucket = flowLog.bucket!;
2121
this.bucketArn = this.exportValue(flowLog.bucket!.bucketArn);
2222

23+
vpc.addFlowLog('FlowLogsS3WithDestinationOptions', {
24+
destination: FlowLogDestination.toS3(undefined, undefined, {
25+
hiveCompatiblePartitions: true,
26+
}),
27+
});
28+
2329
new Instance(this, 'FlowLogsInstance', {
2430
vpc,
2531
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.SMALL),

packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.integ.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
},
3232
"flattenResponse": "false",
33-
"salt": "1656511764157"
33+
"salt": "1657219152690"
3434
},
3535
"UpdateReplacePolicy": "Delete",
3636
"DeletionPolicy": "Delete"
@@ -51,7 +51,7 @@
5151
]
5252
},
5353
"expected": "{\"$ObjectLike\":{\"KeyCount\":1}}",
54-
"salt": "1656511764158"
54+
"salt": "1657219152690"
5555
},
5656
"UpdateReplacePolicy": "Delete",
5757
"DeletionPolicy": "Delete"
@@ -133,7 +133,7 @@
133133
"Runtime": "nodejs14.x",
134134
"Code": {
135135
"S3Bucket": {
136-
"Ref": "AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736S3BucketA9F12763"
136+
"Ref": "AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3S3Bucket5F1832C4"
137137
},
138138
"S3Key": {
139139
"Fn::Join": [
@@ -146,7 +146,7 @@
146146
"Fn::Split": [
147147
"||",
148148
{
149-
"Ref": "AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736S3VersionKey589F30A2"
149+
"Ref": "AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3S3VersionKeyA04E23E6"
150150
}
151151
]
152152
}
@@ -159,7 +159,7 @@
159159
"Fn::Split": [
160160
"||",
161161
{
162-
"Ref": "AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736S3VersionKey589F30A2"
162+
"Ref": "AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3S3VersionKeyA04E23E6"
163163
}
164164
]
165165
}
@@ -191,17 +191,17 @@
191191
}
192192
},
193193
"Parameters": {
194-
"AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736S3BucketA9F12763": {
194+
"AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3S3Bucket5F1832C4": {
195195
"Type": "String",
196-
"Description": "S3 bucket for asset \"41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736\""
196+
"Description": "S3 bucket for asset \"ec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3\""
197197
},
198-
"AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736S3VersionKey589F30A2": {
198+
"AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3S3VersionKeyA04E23E6": {
199199
"Type": "String",
200-
"Description": "S3 key for asset version \"41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736\""
200+
"Description": "S3 key for asset version \"ec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3\""
201201
},
202-
"AssetParameters41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736ArtifactHash2CC614EA": {
202+
"AssetParametersec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3ArtifactHash000AF521": {
203203
"Type": "String",
204-
"Description": "Artifact hash for asset \"41fc8f2dc7c01b34dda9916c7f763e7b7909eb629da9ffe879cb786114aae736\""
204+
"Description": "Artifact hash for asset \"ec094b96e98289a8faed4f4280a8531224c0191f583bc684c21c91a65319e4a3\""
205205
}
206206
}
207207
}

packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.integ.snapshot/FlowLogsFeatureFlag.template.json

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,160 @@
532532
]
533533
}
534534
},
535+
"VPCFlowLogsS3WithDestinationOptionsBucket1B7AC456": {
536+
"Type": "AWS::S3::Bucket",
537+
"Properties": {
538+
"Tags": [
539+
{
540+
"Key": "Name",
541+
"Value": "FlowLogsFeatureFlag/VPC"
542+
}
543+
]
544+
},
545+
"UpdateReplacePolicy": "Retain",
546+
"DeletionPolicy": "Retain"
547+
},
548+
"VPCFlowLogsS3WithDestinationOptionsBucketPolicy35257B71": {
549+
"Type": "AWS::S3::BucketPolicy",
550+
"Properties": {
551+
"Bucket": {
552+
"Ref": "VPCFlowLogsS3WithDestinationOptionsBucket1B7AC456"
553+
},
554+
"PolicyDocument": {
555+
"Statement": [
556+
{
557+
"Action": "s3:PutObject",
558+
"Condition": {
559+
"StringEquals": {
560+
"s3:x-amz-acl": "bucket-owner-full-control",
561+
"aws:SourceAccount": {
562+
"Ref": "AWS::AccountId"
563+
}
564+
},
565+
"ArnLike": {
566+
"aws:SourceArn": {
567+
"Fn::Join": [
568+
"",
569+
[
570+
"arn:",
571+
{
572+
"Ref": "AWS::Partition"
573+
},
574+
":logs:",
575+
{
576+
"Ref": "AWS::Region"
577+
},
578+
":",
579+
{
580+
"Ref": "AWS::AccountId"
581+
},
582+
":*"
583+
]
584+
]
585+
}
586+
}
587+
},
588+
"Effect": "Allow",
589+
"Principal": {
590+
"Service": "delivery.logs.amazonaws.com"
591+
},
592+
"Resource": {
593+
"Fn::Join": [
594+
"",
595+
[
596+
{
597+
"Fn::GetAtt": [
598+
"VPCFlowLogsS3WithDestinationOptionsBucket1B7AC456",
599+
"Arn"
600+
]
601+
},
602+
"/AWSLogs/aws-account-id=",
603+
{
604+
"Ref": "AWS::AccountId"
605+
},
606+
"/*"
607+
]
608+
]
609+
}
610+
},
611+
{
612+
"Action": [
613+
"s3:GetBucketAcl",
614+
"s3:ListBucket"
615+
],
616+
"Condition": {
617+
"StringEquals": {
618+
"aws:SourceAccount": {
619+
"Ref": "AWS::AccountId"
620+
}
621+
},
622+
"ArnLike": {
623+
"aws:SourceArn": {
624+
"Fn::Join": [
625+
"",
626+
[
627+
"arn:",
628+
{
629+
"Ref": "AWS::Partition"
630+
},
631+
":logs:",
632+
{
633+
"Ref": "AWS::Region"
634+
},
635+
":",
636+
{
637+
"Ref": "AWS::AccountId"
638+
},
639+
":*"
640+
]
641+
]
642+
}
643+
}
644+
},
645+
"Effect": "Allow",
646+
"Principal": {
647+
"Service": "delivery.logs.amazonaws.com"
648+
},
649+
"Resource": {
650+
"Fn::GetAtt": [
651+
"VPCFlowLogsS3WithDestinationOptionsBucket1B7AC456",
652+
"Arn"
653+
]
654+
}
655+
}
656+
],
657+
"Version": "2012-10-17"
658+
}
659+
}
660+
},
661+
"VPCFlowLogsS3WithDestinationOptionsFlowLog030C15B2": {
662+
"Type": "AWS::EC2::FlowLog",
663+
"Properties": {
664+
"ResourceId": {
665+
"Ref": "VPCB9E5F0B4"
666+
},
667+
"ResourceType": "VPC",
668+
"TrafficType": "ALL",
669+
"DestinationOptions": {
670+
"fileFormat": "plain-text",
671+
"perHourPartition": false,
672+
"hiveCompatiblePartitions": true
673+
},
674+
"LogDestination": {
675+
"Fn::GetAtt": [
676+
"VPCFlowLogsS3WithDestinationOptionsBucket1B7AC456",
677+
"Arn"
678+
]
679+
},
680+
"LogDestinationType": "s3",
681+
"Tags": [
682+
{
683+
"Key": "Name",
684+
"Value": "FlowLogsFeatureFlag/VPC"
685+
}
686+
]
687+
}
688+
},
535689
"FlowLogsInstanceInstanceSecurityGroupF61782E0": {
536690
"Type": "AWS::EC2::SecurityGroup",
537691
"Properties": {

packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.integ.snapshot/FlowLogsTestStack.template.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@
878878
"Properties": {
879879
"Code": {
880880
"S3Bucket": {
881-
"Ref": "AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbS3Bucket196AD8D5"
881+
"Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2"
882882
},
883883
"S3Key": {
884884
"Fn::Join": [
@@ -891,7 +891,7 @@
891891
"Fn::Split": [
892892
"||",
893893
{
894-
"Ref": "AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbS3VersionKey53E5B9FA"
894+
"Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48"
895895
}
896896
]
897897
}
@@ -904,7 +904,7 @@
904904
"Fn::Split": [
905905
"||",
906906
{
907-
"Ref": "AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbS3VersionKey53E5B9FA"
907+
"Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48"
908908
}
909909
]
910910
}
@@ -943,17 +943,17 @@
943943
}
944944
},
945945
"Parameters": {
946-
"AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbS3Bucket196AD8D5": {
946+
"AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2": {
947947
"Type": "String",
948-
"Description": "S3 bucket for asset \"17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccb\""
948+
"Description": "S3 bucket for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\""
949949
},
950-
"AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbS3VersionKey53E5B9FA": {
950+
"AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48": {
951951
"Type": "String",
952-
"Description": "S3 key for asset version \"17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccb\""
952+
"Description": "S3 key for asset version \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\""
953953
},
954-
"AssetParameters17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccbArtifactHash35F1B2CD": {
954+
"AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB": {
955955
"Type": "String",
956-
"Description": "Artifact hash for asset \"17cb4b37288c269a54418db6e9c7c3763b2d1a82bdc374be4653bd366345eccb\""
956+
"Description": "Artifact hash for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\""
957957
}
958958
}
959959
}

0 commit comments

Comments
 (0)