Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: removes cloudformation yaml from CDK #8669

Merged
merged 5 commits into from
Aug 25, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

exports[`The DotcomRendering stack matches the snapshot 1`] = `
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Frontend rendering service",
"Mappings": {
"Constants": {
"App": {
"Value": "rendering",
},
"Stack": {
"Value": "frontend",
},
},
},
"Metadata": {
"gu:cdk:constructs": [
"GuVpcParameter",
Expand Down Expand Up @@ -54,35 +42,11 @@ exports[`The DotcomRendering stack matches the snapshot 1`] = `
},
},
"Parameters": {
"AMI": {
"Description": "AMI to use for instances",
"Type": "AWS::EC2::Image::Id",
},
"AMIRendering": {
"Default": "/TEST/frontend/rendering/ami.imageId",
"Description": "Amazon Machine Image ID for the app rendering. Use this in conjunction with AMIgo to keep AMIs up to date.",
"Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
},
"App": {
"Default": "rendering",
"Description": "Application name",
"Type": "String",
},
"Backend5XXAlarmPeriod": {
"Default": "60",
"Description": "(Optional) Duration in seconds before 5XX alarm is triggered",
"Type": "String",
},
"Backend5XXAlarmThreshold": {
"Default": "100",
"Description": "(Optional) Max number of errors before the 5XX alarm is triggered",
"Type": "String",
},
"Backend5XXConsecutivePeriod": {
"Default": "5",
"Description": "(Optional) Number of consecutive periods the threshold needs to be reached before 5XX alarm is triggered",
"Type": "String",
},
"DistributionBucketName": {
"Default": "/account/services/artifact.bucket",
"Description": "SSM parameter containing the S3 bucket name holding distribution artifacts",
Expand All @@ -93,28 +57,15 @@ exports[`The DotcomRendering stack matches the snapshot 1`] = `
"Description": "S3 Bucket Name for ELB logs",
"Type": "AWS::SSM::Parameter::Value<String>",
},
"ELKStream": {
"Description": "name of the kinesis stream to use to send logs to the central ELK stack",
"Type": "String",
},
"ELKStreamId": {
"Default": "/TEST/frontend/rendering/logging.stream.name",
"Type": "AWS::SSM::Parameter::Value<String>",
},
"InstanceType": {
"Description": "EC2 Instance Type to use for dotcom-rendering",
"Type": "String",
},
"LoggingStreamName": {
"Default": "/account/services/logging.stream.name",
"Description": "SSM parameter containing the Name (not ARN) on the kinesis stream",
"Type": "AWS::SSM::Parameter::Value<String>",
},
"NotificationAlarmAction": {
"Default": "",
"Description": "(Optional) ARN of action to execute when notification alarms change state",
"Type": "CommaDelimitedList",
},
"PrivateSubnets": {
"Default": "/account/vpc/primary/subnets/private",
"Description": "A list of private subnets",
Expand All @@ -125,24 +76,6 @@ exports[`The DotcomRendering stack matches the snapshot 1`] = `
"Description": "A list of public subnets",
"Type": "AWS::SSM::Parameter::Value<List<AWS::EC2::Subnet::Id>>",
},
"Stack": {
"Default": "frontend",
"Description": "Stack name",
"Type": "String",
},
"Stage": {
"AllowedValues": [
"PROD",
"CODE",
],
"Default": "CODE",
"Description": "Stage name",
"Type": "String",
},
"Subnets": {
"Description": "The subnets where rendering instances will run",
"Type": "List<AWS::EC2::Subnet::Id>",
},
"VpcId": {
"Default": "/account/vpc/primary/id",
"Description": "Virtual Private Cloud to run EC2 instances within. Should NOT be the account default VPC.",
Expand Down Expand Up @@ -562,17 +495,6 @@ exports[`The DotcomRendering stack matches the snapshot 1`] = `
},
"Type": "AWS::IAM::Policy",
},
"InstanceProfile": {
"Properties": {
"Path": "/",
"Roles": [
{
"Ref": "InstanceRole",
},
],
},
"Type": "AWS::IAM::InstanceProfile",
},
"InstanceRole": {
"Properties": {
"AssumeRolePolicyDocument": {
Expand Down
19 changes: 0 additions & 19 deletions dotcom-rendering/cdk/lib/dotcom-rendering.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { join } from 'node:path';
import { GuAutoScalingGroup } from '@guardian/cdk/lib/constructs/autoscaling';
import {
GuAmiParameter,
Expand All @@ -25,7 +24,6 @@ import {
import { CfnAlarm } from 'aws-cdk-lib/aws-cloudwatch';
import { InstanceType, Peer } from 'aws-cdk-lib/aws-ec2';
import { LoadBalancingProtocol } from 'aws-cdk-lib/aws-elasticloadbalancing';
import { CfnInclude } from 'aws-cdk-lib/cloudformation-include';
import type { DCRProps } from './types';
import { getUserData } from './userData';

Expand Down Expand Up @@ -265,12 +263,6 @@ export class DotcomRendering extends GuStack {
alarmActions: [scaleUpPolicy.attrArn],
});

const yamlTemplateFilePath = join(
__dirname,
'../..',
'cloudformation.yml',
);

const criticalAlertsTopicArn = `arn:aws:sns:${region}:${this.account}:Frontend-${stage}-CriticalAlerts`;
const backend5XXAlarmThreshold = 100;
const backend5XXAlarmPeriod = 60;
Expand All @@ -296,17 +288,6 @@ export class DotcomRendering extends GuStack {
okActions: [criticalAlertsTopicArn],
});

new CfnInclude(this, 'YamlTemplate', {
templateFile: yamlTemplateFilePath,
parameters: {
AutoscalingGroup: asg.autoScalingGroupName,
InternalLoadBalancer: loadBalancer.loadBalancerName,
InstanceRole: instanceRole.roleName,
ScaleUpPolicy: scaleUpPolicy.ref,
ScaleDownPolicy: scaleDownPolicy.ref,
},
});

new CfnOutput(this, 'LoadBalancerUrl', {
value: loadBalancer.loadBalancerDnsName,
});
Expand Down
84 changes: 0 additions & 84 deletions dotcom-rendering/cloudformation.yml

This file was deleted.