Skip to content

Commit 078cb78

Browse files
Switch to using GuCDK-defined load balancer
Updates the CNAME for `registration` to use the new GuCDK-defined load balancer. Additionally, swap the enablement status of the alarms: - Disable the Low2XX alarms for the legacy load balancer - Enable the Low2XX alarms for the new load balancer Co-authored-by: Julia Branke <JuliaBrigitte@users.noreply.github.com>
1 parent 0c85154 commit 078cb78

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
575575
"ResourceRecords": [
576576
{
577577
"Fn::GetAtt": [
578-
"LoadBalancerToPrivateASG",
578+
"LoadBalancerRegistration79F7817E",
579579
"DNSName",
580580
],
581581
},
@@ -1174,7 +1174,7 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
11741174
},
11751175
"Low2XXIn1dayE630C03B": {
11761176
"Properties": {
1177-
"ActionsEnabled": false,
1177+
"ActionsEnabled": true,
11781178
"AlarmActions": [
11791179
{
11801180
"Fn::Join": [
@@ -1250,7 +1250,7 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
12501250
},
12511251
"Low2XXIn30minutesE2E53BDD": {
12521252
"Properties": {
1253-
"ActionsEnabled": false,
1253+
"ActionsEnabled": true,
12541254
"AlarmActions": [
12551255
{
12561256
"Fn::Join": [
@@ -1414,6 +1414,7 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
14141414
},
14151415
"NotEnoughHttpCode200sAlarm": {
14161416
"Properties": {
1417+
"ActionsEnabled": false,
14171418
"AlarmActions": [
14181419
{
14191420
"Ref": "AlarmTopic",
@@ -1472,6 +1473,7 @@ exports[`The Registration stack matches the snapshot for CODE 1`] = `
14721473
},
14731474
"NotEnoughHttpCode200sPerDayAlarm": {
14741475
"Properties": {
1476+
"ActionsEnabled": false,
14751477
"AlarmActions": [
14761478
{
14771479
"Ref": "AlarmTopic",
@@ -2558,7 +2560,7 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
25582560
"ResourceRecords": [
25592561
{
25602562
"Fn::GetAtt": [
2561-
"LoadBalancerToPrivateASG",
2563+
"LoadBalancerRegistration79F7817E",
25622564
"DNSName",
25632565
],
25642566
},
@@ -3157,7 +3159,7 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
31573159
},
31583160
"Low2XXIn1dayE630C03B": {
31593161
"Properties": {
3160-
"ActionsEnabled": false,
3162+
"ActionsEnabled": true,
31613163
"AlarmActions": [
31623164
{
31633165
"Fn::Join": [
@@ -3233,7 +3235,7 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
32333235
},
32343236
"Low2XXIn30minutesE2E53BDD": {
32353237
"Properties": {
3236-
"ActionsEnabled": false,
3238+
"ActionsEnabled": true,
32373239
"AlarmActions": [
32383240
{
32393241
"Fn::Join": [
@@ -3397,6 +3399,7 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
33973399
},
33983400
"NotEnoughHttpCode200sAlarm": {
33993401
"Properties": {
3402+
"ActionsEnabled": false,
34003403
"AlarmActions": [
34013404
{
34023405
"Ref": "AlarmTopic",
@@ -3455,6 +3458,7 @@ exports[`The Registration stack matches the snapshot for PROD 1`] = `
34553458
},
34563459
"NotEnoughHttpCode200sPerDayAlarm": {
34573460
"Properties": {
3461+
"ActionsEnabled": false,
34583462
"AlarmActions": [
34593463
{
34603464
"Ref": "AlarmTopic",

cdk/lib/registration.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
InstanceType,
1919
SecurityGroup,
2020
} from 'aws-cdk-lib/aws-ec2';
21-
import type { CfnLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancing';
2221
import { HttpCodeTarget } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
2322
import { Topic } from 'aws-cdk-lib/aws-sns';
2423
import { CfnInclude } from 'aws-cdk-lib/cloudformation-include';
@@ -45,7 +44,7 @@ export class Registration extends GuStack {
4544
// Until this project has been fully migrated to GuCDK you should update the 'old' infrastructure by modifying
4645
// the YAML file and then re-running the snapshot tests to confirm that the changes are being pulled through by
4746
// CDK
48-
const template = new CfnInclude(this, 'YamlTemplate', {
47+
new CfnInclude(this, 'YamlTemplate', {
4948
templateFile: yamlTemplateFilePath,
5049
});
5150

@@ -154,7 +153,7 @@ export class Registration extends GuStack {
154153
statistic: 'Sum',
155154
})
156155
.createAlarm(this, `Low2XXIn${humanPeriod}`, {
157-
actionsEnabled: false,
156+
actionsEnabled: true,
158157
alarmDescription: `Triggers if load balancer in ${stage} does not have enough 200s in ${humanPeriod}. ${runbookCopy}`,
159158
comparisonOperator: ComparisonOperator.LESS_THAN_THRESHOLD,
160159
evaluationPeriods: 1,
@@ -168,17 +167,11 @@ export class Registration extends GuStack {
168167

169168
adjustCloudformationParameters(this);
170169

171-
const legacyLoadBalancer = template.getResource(
172-
'LoadBalancerToPrivateASG',
173-
) as CfnLoadBalancer;
174-
175170
// This CNAME represents the public URL for the registration service.
176171
new GuCname(this, 'DnsRecordForRegistration', {
177172
app,
178173
domainName: props.domainName,
179-
// For now we are still routing traffic to the legacy ELB.
180-
// To complete the migration, we'll update to point at playApp.loadBalancer.loadBalancerDnsName.
181-
resourceRecord: legacyLoadBalancer.attrDnsName,
174+
resourceRecord: loadBalancer.loadBalancerDnsName,
182175

183176
// Intentionally low TTL for faster DNS changes
184177
// TODO increase this to 7200 (2 hours) after the migration is complete

registration/conf/registration.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ Resources:
309309
NotEnoughHttpCode200sAlarm:
310310
Type: AWS::CloudWatch::Alarm
311311
Properties:
312+
ActionsEnabled: FALSE
312313
AlarmActions: [!Ref AlarmTopic]
313314
OKActions: [!Ref AlarmTopic]
314315
AlarmDescription: !Sub Triggers if load balancer in ${Stage} does not have enough 200s in half an hour. ${RunbookCopy}
@@ -328,6 +329,7 @@ Resources:
328329
NotEnoughHttpCode200sPerDayAlarm:
329330
Type: AWS::CloudWatch::Alarm
330331
Properties:
332+
ActionsEnabled: FALSE
331333
AlarmActions: [!Ref AlarmTopic]
332334
OKActions: [!Ref AlarmTopic]
333335
AlarmDescription: !Sub Triggers if load balancer in ${Stage} does not have enough 200s in a whole day. ${RunbookCopy}

0 commit comments

Comments
 (0)