Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const notificationCodeProps: NotificationProps = {
stage: 'CODE',
env: { region: 'eu-west-1' },
domainName: 'notification.notifications.code.dev-guardianapis.com',
intermediateCname:
'notification.notifications-aws.code.dev-guardianapis.com.',
instanceMetricGranularity: '5Minute',
workerSqsQueueName: 'mobile-notifications-harvester-CODE-Sqs-1R9TBA4F2C6TG',
sloMonitoringQueueName: 'notifications-slo-monitoring-CODE',
Expand All @@ -28,6 +30,7 @@ export const notificationProdProps: NotificationProps = {
stage: 'PROD',
env: { region: 'eu-west-1' },
domainName: 'notification.notifications.guardianapis.com',
intermediateCname: 'notification.notifications-aws.guardianapis.com.',
instanceMetricGranularity: '1Minute',
workerSqsQueueName: 'mobile-notifications-harvester-PROD-Sqs-NPP9X15G7WAO',
sloMonitoringQueueName: 'notifications-slo-monitoring-PROD',
Expand Down
26 changes: 26 additions & 0 deletions cdk/lib/__snapshots__/notification.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ exports[`The Notification stack matches the snapshot for CODE 1`] = `
"Metadata": {
"gu:cdk:constructs": [
"GuStringParameter",
"GuCname",
"GuAllowPolicy",
"GuAllowPolicy",
"GuAllowPolicy",
Expand Down Expand Up @@ -448,6 +449,18 @@ exports[`The Notification stack matches the snapshot for CODE 1`] = `
},
"Type": "AWS::Route53::RecordSet",
},
"DnsRecordForNotification": {
"Properties": {
"Name": "notification.notifications.code.dev-guardianapis.com",
"RecordType": "CNAME",
"ResourceRecords": [
"notification.notifications-aws.code.dev-guardianapis.com.",
],
"Stage": "CODE",
"TTL": 3600,
},
"Type": "Guardian::DNS::RecordSet",
},
"DynamoDbReportsAccessD5A9D3BB": {
"Properties": {
"PolicyDocument": {
Expand Down Expand Up @@ -2234,6 +2247,7 @@ exports[`The Notification stack matches the snapshot for PROD 1`] = `
"Metadata": {
"gu:cdk:constructs": [
"GuStringParameter",
"GuCname",
"GuAllowPolicy",
"GuAllowPolicy",
"GuAllowPolicy",
Expand Down Expand Up @@ -2637,6 +2651,18 @@ exports[`The Notification stack matches the snapshot for PROD 1`] = `
},
"Type": "AWS::Route53::RecordSet",
},
"DnsRecordForNotification": {
"Properties": {
"Name": "notification.notifications.guardianapis.com",
"RecordType": "CNAME",
"ResourceRecords": [
"notification.notifications-aws.guardianapis.com.",
],
"Stage": "PROD",
"TTL": 3600,
},
"Type": "Guardian::DNS::RecordSet",
},
"DynamoDbReportsAccessD5A9D3BB": {
"Properties": {
"PolicyDocument": {
Expand Down
14 changes: 13 additions & 1 deletion cdk/lib/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
GuStringParameter,
GuVpcParameter,
} from '@guardian/cdk/lib/constructs/core';
import { GuCname } from '@guardian/cdk/lib/constructs/dns';
import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam';
import type { App } from 'aws-cdk-lib';
import { Duration, Tags } from 'aws-cdk-lib';
Expand All @@ -22,7 +23,9 @@ export interface NotificationProps extends GuStackProps {
domainName:
| 'notification.notifications.guardianapis.com'
| 'notification.notifications.code.dev-guardianapis.com';

intermediateCname:
| 'notification.notifications-aws.guardianapis.com.'
| 'notification.notifications-aws.code.dev-guardianapis.com.';
instanceMetricGranularity: '1Minute' | '5Minute';
/**
* The ARN of the SQS queue consumed by the workers (harvester).
Expand Down Expand Up @@ -66,6 +69,15 @@ export class Notification extends GuStack {
fromSSM: true,
}).valueAsString;

new GuCname(this, 'DnsRecordForNotification', {
app,
domainName: props.domainName,
// For now we are still routing traffic via the intermediate CNAME, which points at the legacy ELB.
// To complete the migration, we'll remove this intermediate CNAME and point at playApp.loadBalancer.loadBalancerDnsName.
resourceRecord: props.intermediateCname,
ttl: Duration.seconds(3600),
});

const reportsTable = Table.fromTableName(
this,
'ReportsTable',
Expand Down