Skip to content

Commit 79f592b

Browse files
committed
feat: Meet devx-logs requirements
https://github.com/guardian/devx-logs requires additional ASG tags and the `ec2:DescribeInstances` IAM permission.
1 parent 8df1738 commit 79f592b

7 files changed

Lines changed: 61 additions & 3 deletions

File tree

cdk/lib/__snapshots__/registration.test.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,11 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
739739
"PropagateAtLaunch": true,
740740
"Value": "CODE",
741741
},
742+
{
743+
"Key": "SystemdUnit",
744+
"PropagateAtLaunch": true,
745+
"Value": "registration.service",
746+
},
742747
],
743748
"VPCZoneIdentifier": {
744749
"Ref": "PrivateSubnets",
@@ -1570,6 +1575,11 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
15701575
"PropagateAtLaunch": true,
15711576
"Value": "PROD",
15721577
},
1578+
{
1579+
"Key": "SystemdUnit",
1580+
"PropagateAtLaunch": true,
1581+
"Value": "registration.service",
1582+
},
15731583
],
15741584
"VPCZoneIdentifier": {
15751585
"Ref": "PrivateSubnets",

cdk/lib/__snapshots__/report.test.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ exports[`The Report stack matches the snapshot for CODE 1`] = `
150150
"PropagateAtLaunch": true,
151151
"Value": "CODE",
152152
},
153+
{
154+
"Key": "SystemdUnit",
155+
"PropagateAtLaunch": true,
156+
"Value": "report.service",
157+
},
153158
],
154159
"TargetGroupARNs": [
155160
{
@@ -1821,6 +1826,11 @@ exports[`The Report stack matches the snapshot for PROD 1`] = `
18211826
"PropagateAtLaunch": true,
18221827
"Value": "PROD",
18231828
},
1829+
{
1830+
"Key": "SystemdUnit",
1831+
"PropagateAtLaunch": true,
1832+
"Value": "report.service",
1833+
},
18241834
],
18251835
"TargetGroupARNs": [
18261836
{

cdk/lib/report.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ export class Report extends GuStack {
8585
timeout: Duration.seconds(10), // The default is 5s
8686
unhealthyThresholdCount: 10, // This also seems unusually high - the default is 2
8787
},
88+
applicationLogging: {
89+
enabled: true,
90+
systemdUnitName: app,
91+
},
8892
});
8993

9094
//TODO check if this customisation is really necessary (it has been copied across from

notification/conf/notification.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ Parameters:
9595
RunbookCopy:
9696
Type: String
9797
Default: <<<Runbook|https://docs.google.com/document/d/1aJMytnPGeWH8YLpD2_66doxqyr8dPvAVonYIOG-zmOA>>>
98-
98+
LoggingStreamName:
99+
Type: AWS::SSM::Parameter::Value<String>
100+
Description: SSM parameter containing the Name (not ARN) on the kinesis stream
101+
AllowedValues:
102+
- /account/services/logging.stream.name.code
103+
- /account/services/logging.stream.name
99104
Resources:
100105
DnsRecord:
101106
Type: AWS::Route53::RecordSet
@@ -238,7 +243,9 @@ Resources:
238243
Resource:
239244
- !Sub arn:aws:s3:::${DistBucket}/*
240245
- !Sub arn:aws:s3:::${S3TopicCountBucket}/*
241-
- Action: ec2:DescribeTags
246+
- Action:
247+
- ec2:DescribeTags
248+
- ec2:DescribeInstances
242249
Effect: Allow
243250
Resource: '*'
244251
- Action:
@@ -324,6 +331,12 @@ Resources:
324331
PropagateAtLaunch: true
325332
Value:
326333
!FindInMap [Constants, App, Value]
334+
- Key: SystemdUnit
335+
Value: notification.service
336+
PropagateAtLaunch: true
337+
- Key: LogKinesisStreamName
338+
Value: !Ref LoggingStreamName
339+
PropagateAtLaunch: true
327340
VPCZoneIdentifier: !Ref PrivateSubnets
328341
NotificationInstanceProfile:
329342
Type: AWS::IAM::InstanceProfile

notification/conf/riff-raff.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ deployments:
1313
templateStageParameters:
1414
CODE:
1515
SloSqsQueueArn: /notifications/CODE/mobile-notifications/notifications.queues.sloMonitoringArn
16+
LoggingStreamName: /account/services/logging.stream.name.code
1617
PROD:
1718
SloSqsQueueArn: /notifications/PROD/mobile-notifications/notifications.queues.sloMonitoringArn
19+
LoggingStreamName: /account/services/logging.stream.name
1820
notification:
1921
type: autoscaling
2022
parameters:

registration/conf/registration.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ Parameters:
8080
RunbookCopy:
8181
Type: String
8282
Default: <<<Runbook|https://docs.google.com/document/d/1aJMytnPGeWH8YLpD2_66doxqyr8dPvAVonYIOG-zmOA>>>
83+
LoggingStreamName:
84+
Type: AWS::SSM::Parameter::Value<String>
85+
Description: SSM parameter containing the Name (not ARN) on the kinesis stream
86+
AllowedValues:
87+
- /account/services/logging.stream.name.code
88+
- /account/services/logging.stream.name
8389
Resources:
8490
DistributionInstanceProfile:
8591
Type: AWS::IAM::InstanceProfile
@@ -105,7 +111,9 @@ Resources:
105111
- Action: s3:GetObject
106112
Effect: Allow
107113
Resource: !Sub arn:aws:s3:::${DistBucket}/*
108-
- Action: ec2:DescribeTags
114+
- Action:
115+
- ec2:DescribeTags
116+
- ec2:DescribeInstances
109117
Effect: Allow
110118
Resource: '*'
111119
- Action:
@@ -267,6 +275,12 @@ Resources:
267275
PropagateAtLaunch: true
268276
Value:
269277
!FindInMap [Constants, App, Value]
278+
- Key: SystemdUnit
279+
Value: registration.service
280+
PropagateAtLaunch: true
281+
- Key: LogKinesisStreamName
282+
Value: !Ref LoggingStreamName
283+
PropagateAtLaunch: true
270284
VPCZoneIdentifier: !Ref PrivateSubnets
271285
RegistrationLaunchConfig:
272286
Type: AWS::AutoScaling::LaunchConfiguration

registration/conf/riff-raff.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ deployments:
1212
templateStagePaths:
1313
CODE: Registration-CODE.template.json
1414
PROD: Registration-PROD.template.json
15+
templateStageParameters:
16+
CODE:
17+
LoggingStreamName: /account/services/logging.stream.name.code
18+
PROD:
19+
LoggingStreamName: /account/services/logging.stream.name
1520
registration:
1621
type: autoscaling
1722
parameters:

0 commit comments

Comments
 (0)