Skip to content

Commit b1f4e27

Browse files
authored
feat(cloudfront): Add RealtimeLogConfig to Distribution (#26808)
Pull request to implement RealtimeLogConfig on CloudFront Distribution. As well as being able to use `RealtimeLogConfigArn` on `Distribution`, I also added `RealtimeLogConfig` as a Construct so that the Cfn is abstracted too. The reason this is needed so that we can add realtime log config to a `Distribution` without reverting to using `CfnDistribution`. Closes #<issue number here>. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6fb1207 commit b1f4e27

18 files changed

+1345
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"33.0.0"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "33.0.0",
3+
"files": {
4+
"065ae19c4c6accff85009f33f18e0ec2e2ed000b2cd704aed4eaa1778b943256": {
5+
"source": {
6+
"path": "integ-realtime-config.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "065ae19c4c6accff85009f33f18e0ec2e2ed000b2cd704aed4eaa1778b943256.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"Resources": {
3+
"Role1ABCC5F0": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "cloudfront.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"RoleDefaultPolicy5FFB7DAB": {
21+
"Type": "AWS::IAM::Policy",
22+
"Properties": {
23+
"PolicyDocument": {
24+
"Statement": [
25+
{
26+
"Action": [
27+
"kinesis:DescribeStream",
28+
"kinesis:DescribeStreamSummary",
29+
"kinesis:PutRecord",
30+
"kinesis:PutRecords"
31+
],
32+
"Effect": "Allow",
33+
"Resource": {
34+
"Fn::GetAtt": [
35+
"stream19075594",
36+
"Arn"
37+
]
38+
}
39+
}
40+
],
41+
"Version": "2012-10-17"
42+
},
43+
"PolicyName": "RoleDefaultPolicy5FFB7DAB",
44+
"Roles": [
45+
{
46+
"Ref": "Role1ABCC5F0"
47+
}
48+
]
49+
}
50+
},
51+
"stream19075594": {
52+
"Type": "AWS::Kinesis::Stream",
53+
"Properties": {
54+
"RetentionPeriodHours": 24,
55+
"StreamEncryption": {
56+
"EncryptionType": "KMS",
57+
"KeyId": "alias/aws/kinesis"
58+
},
59+
"StreamModeDetails": {
60+
"StreamMode": "ON_DEMAND"
61+
}
62+
}
63+
},
64+
"RealtimeLog31F8FA14": {
65+
"Type": "AWS::CloudFront::RealtimeLogConfig",
66+
"Properties": {
67+
"EndPoints": [
68+
{
69+
"KinesisStreamConfig": {
70+
"RoleArn": {
71+
"Fn::GetAtt": [
72+
"Role1ABCC5F0",
73+
"Arn"
74+
]
75+
},
76+
"StreamArn": {
77+
"Fn::GetAtt": [
78+
"stream19075594",
79+
"Arn"
80+
]
81+
}
82+
},
83+
"StreamType": "Kinesis"
84+
}
85+
],
86+
"Fields": [
87+
"timestamp"
88+
],
89+
"Name": "testing",
90+
"SamplingRate": 1
91+
}
92+
}
93+
},
94+
"Parameters": {
95+
"BootstrapVersion": {
96+
"Type": "AWS::SSM::Parameter::Value<String>",
97+
"Default": "/cdk-bootstrap/hnb659fds/version",
98+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
99+
}
100+
},
101+
"Rules": {
102+
"CheckBootstrapVersion": {
103+
"Assertions": [
104+
{
105+
"Assert": {
106+
"Fn::Not": [
107+
{
108+
"Fn::Contains": [
109+
[
110+
"1",
111+
"2",
112+
"3",
113+
"4",
114+
"5"
115+
],
116+
{
117+
"Ref": "BootstrapVersion"
118+
}
119+
]
120+
}
121+
]
122+
},
123+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
124+
}
125+
]
126+
}
127+
}
128+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "33.0.0",
3+
"testCases": {
4+
"integ-realtime-config/realtime-log-config/DefaultTest": {
5+
"stacks": [
6+
"integ-realtime-config"
7+
],
8+
"assertionStack": "integ-realtime-config/realtime-log-config/DefaultTest/DeployAssert",
9+
"assertionStackName": "integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F"
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "33.0.0",
3+
"files": {
4+
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
5+
"source": {
6+
"path": "integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"Parameters": {
3+
"BootstrapVersion": {
4+
"Type": "AWS::SSM::Parameter::Value<String>",
5+
"Default": "/cdk-bootstrap/hnb659fds/version",
6+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
7+
}
8+
},
9+
"Rules": {
10+
"CheckBootstrapVersion": {
11+
"Assertions": [
12+
{
13+
"Assert": {
14+
"Fn::Not": [
15+
{
16+
"Fn::Contains": [
17+
[
18+
"1",
19+
"2",
20+
"3",
21+
"4",
22+
"5"
23+
],
24+
{
25+
"Ref": "BootstrapVersion"
26+
}
27+
]
28+
}
29+
]
30+
},
31+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
32+
}
33+
]
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"version": "33.0.0",
3+
"artifacts": {
4+
"integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.assets": {
5+
"type": "cdk:asset-manifest",
6+
"properties": {
7+
"file": "integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.assets.json",
8+
"requiresBootstrapStackVersion": 6,
9+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
10+
}
11+
},
12+
"integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F": {
13+
"type": "aws:cloudformation:stack",
14+
"environment": "aws://unknown-account/unknown-region",
15+
"properties": {
16+
"templateFile": "integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.template.json",
17+
"validateOnSynth": false,
18+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
19+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
21+
"requiresBootstrapStackVersion": 6,
22+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
23+
"additionalDependencies": [
24+
"integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.assets"
25+
],
26+
"lookupRole": {
27+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
28+
"requiresBootstrapStackVersion": 8,
29+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
30+
}
31+
},
32+
"dependencies": [
33+
"integrealtimeconfigrealtimelogconfigDefaultTestDeployAssert02ABDB2F.assets"
34+
],
35+
"metadata": {
36+
"/integ-realtime-config/realtime-log-config/DefaultTest/DeployAssert/BootstrapVersion": [
37+
{
38+
"type": "aws:cdk:logicalId",
39+
"data": "BootstrapVersion"
40+
}
41+
],
42+
"/integ-realtime-config/realtime-log-config/DefaultTest/DeployAssert/CheckBootstrapVersion": [
43+
{
44+
"type": "aws:cdk:logicalId",
45+
"data": "CheckBootstrapVersion"
46+
}
47+
]
48+
},
49+
"displayName": "integ-realtime-config/realtime-log-config/DefaultTest/DeployAssert"
50+
},
51+
"integ-realtime-config.assets": {
52+
"type": "cdk:asset-manifest",
53+
"properties": {
54+
"file": "integ-realtime-config.assets.json",
55+
"requiresBootstrapStackVersion": 6,
56+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
57+
}
58+
},
59+
"integ-realtime-config": {
60+
"type": "aws:cloudformation:stack",
61+
"environment": "aws://unknown-account/unknown-region",
62+
"properties": {
63+
"templateFile": "integ-realtime-config.template.json",
64+
"validateOnSynth": false,
65+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
66+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
67+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/065ae19c4c6accff85009f33f18e0ec2e2ed000b2cd704aed4eaa1778b943256.json",
68+
"requiresBootstrapStackVersion": 6,
69+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
70+
"additionalDependencies": [
71+
"integ-realtime-config.assets"
72+
],
73+
"lookupRole": {
74+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
75+
"requiresBootstrapStackVersion": 8,
76+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
77+
}
78+
},
79+
"dependencies": [
80+
"integ-realtime-config.assets"
81+
],
82+
"metadata": {
83+
"/integ-realtime-config/Role/Resource": [
84+
{
85+
"type": "aws:cdk:logicalId",
86+
"data": "Role1ABCC5F0"
87+
}
88+
],
89+
"/integ-realtime-config/Role/DefaultPolicy/Resource": [
90+
{
91+
"type": "aws:cdk:logicalId",
92+
"data": "RoleDefaultPolicy5FFB7DAB"
93+
}
94+
],
95+
"/integ-realtime-config/stream/Resource": [
96+
{
97+
"type": "aws:cdk:logicalId",
98+
"data": "stream19075594"
99+
}
100+
],
101+
"/integ-realtime-config/RealtimeLog/Resource": [
102+
{
103+
"type": "aws:cdk:logicalId",
104+
"data": "RealtimeLog31F8FA14"
105+
}
106+
],
107+
"/integ-realtime-config/BootstrapVersion": [
108+
{
109+
"type": "aws:cdk:logicalId",
110+
"data": "BootstrapVersion"
111+
}
112+
],
113+
"/integ-realtime-config/CheckBootstrapVersion": [
114+
{
115+
"type": "aws:cdk:logicalId",
116+
"data": "CheckBootstrapVersion"
117+
}
118+
]
119+
},
120+
"displayName": "integ-realtime-config"
121+
},
122+
"Tree": {
123+
"type": "cdk:tree",
124+
"properties": {
125+
"file": "tree.json"
126+
}
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)